kafka-manager It's open source from Yahoo apache-kafka Management tools , Yes, it is Scala Compiling , Can be in web Page progress kafka Related operations of .

 

One 、 Make kafkamanager Of image Mirror image

download kafka-manager-2.0.0.2.zip, In the conf Under the application.conf In the document , modify kafka-manager.zkhosts Address and cmake.zkhosts The address is :

zok-0.zk-hs.wiseco.svc.cluster.local:2181,zok-1.zk-hs.wiseco.svc.cluster.local:2181,zok-2.zk-hs.wiseco.svc.cluster.local:2181

[[email protected] kafkamanager]# pwd
/home/k8s_deploy/fin/online/deploy/kafkamanager
 
[[email protected] kafkamanager]# ll
total 59228
-rw-r--r-- 1 root root      353 Jan 27 17:42 Dockerfile
-rw-r--r-- 1 root root 60639694 Jan 27 17:48 kafka-manager-2.0.0.2.zip
 
[[email protected] kafkamanager]# unzip kafka-manager-2.0.0.2.zip
[[email protected] kafkamanager]# ll
total 59228
-rw-r--r-- 1 root root      353 Jan 27 17:42 Dockerfile
drwxr-xr-x 6 root root     4096 Jan 27 18:09 kafka-manager-2.0.0.2
-rw-r--r-- 1 root root 60639694 Jan 27 17:48 kafka-manager-2.0.0.2.zip
[[email protected] kafkamanager]# cd kafka-manager-2.0.0.2/conf/
[[email protected] conf]# vim application.conf
...........
...........
kafka-manager.zkhosts="zok-0.zk-hs.wiseco.svc.cluster.local:2181,zok-1.zk-hs.wiseco.svc.cluster.local:2181,zok-2.zk-hs.wiseco.svc.cluster.local:2181"
...........
...........
basicAuthentication.enabled=true       # User password login is enabled here , Default false Is not enabled  ( In addition to enabling user login here ,  It can also be enabled later ldap)
basicAuthentication.enabled=${?KAFKA_MANAGER_AUTH_ENABLED}
...........
...........
basicAuthentication.username="admin"
basicAuthentication.username=${?KAFKA_MANAGER_USERNAME}
basicAuthentication.password="[email protected]"           # Change user login password
basicAuthentication.password=${?KAFKA_MANAGER_PASSWORD}
...........
...........
 
REPACK
[[email protected] conf]# cd ../../
[[email protected] kafkamanager]# ll
total 59228
-rw-r--r-- 1 root root      353 Jan 27 17:42 Dockerfile
drwxr-xr-x 6 root root     4096 Jan 27 18:09 kafka-manager-2.0.0.2
-rw-r--r-- 1 root root 60639694 Jan 27 17:48 kafka-manager-2.0.0.2.zip
 
[[email protected] kafkamanager]# rm -rf kafka-manager-2.0.0.2.zip
[[email protected] kafkamanager]# tar -zvcf kafka-manager-2.0.0.2.tar.gz kafka-manager-2.0.0.2
 
[[email protected] kafkamanager]# rm -rf kafka-manager-2.0.0.2
[[email protected] kafkamanager]# ll
total 58000
-rw-r--r-- 1 root root      353 Jan 27 17:42 Dockerfile
-rw-r--r-- 1 root root 59387703 Jan 27 18:13 kafka-manager-2.0.0.2.tar.gz
 
Make Dockerfile Mirror image
[[email protected] kafkamanager]# cat Dockerfile
FROM 192.168.10.10/wiseco/jdk1.8.0_192
RUN rm -f /etc/localtime \
&& ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
 
ENV LANG en_US.UTF-8
 
ADD kafka-manager-2.0.0.2.tar.gz /opt/
RUN mv /opt/kafka-manager-2.0.0.2 /opt/kafka-manager
 
EXPOSE 9000
CMD ["/opt/kafka-manager/bin/kafka-manager"]
 
Upload to harbor Warehouse
[[email protected] kafkamanager]# docker build -t 192.168.10.10/wiseco/kafka-manager-2.0.0.2:v1 .
[[email protected] kafkamanager]# docker push 192.168.10.10/wiseco/kafka-manager-2.0.0.2:v1

Two 、 establish kafkamanager Of pod

[[email protected] kafkamanager]# pwd
/opt/k8s/k8s-project/kafka_zk/kafkamanager
[[email protected] kafkamanager]# cat kafkamanager.yaml
apiVersion: v1
kind: Service
metadata:
  name: kafkamanager
  namespace: wiseco
  labels:
    app: kafkamanager
spec:
  type: NodePort
  selector:
    app: kafkamanager
  ports:
  - name: http
    port: 9000
    targetPort: 9000
    nodePort: 39921
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kafkamanager
  namespace: wiseco
spec:
  replicas: 1
  minReadySeconds: 10
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  selector:
    matchLabels:
      app: kafkamanager
  template:
    metadata:
      labels:
        app: kafkamanager
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: "app"
                    operator: In
                    values:
                      - kafkamanager
              topologyKey: "kubernetes.io/hostname"
      terminationGracePeriodSeconds: 120
      containers:
      - name: kafkamanager
        image: 192.168.10.10/wiseco/kafka-manager-2.0.0.2:v1
        imagePullPolicy: Always
        ports:
        - name: cport
          containerPort: 9000
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 500m
            memory: 400Mi
        lifecycle:
          postStart:
            exec:
              command: ["/bin/sh","-c","touch /tmp/health"]
        livenessProbe:
          exec:
            command: ["test","-e","/tmp/health"]
          initialDelaySeconds: 5
          timeoutSeconds: 5
          periodSeconds: 10
        readinessProbe:
          tcpSocket:
            port: cport
          initialDelaySeconds: 15
          timeoutSeconds: 5
          periodSeconds: 20

Create and view

[[email protected] kafkamanager]# kubectl apply -f kafkamanager.yaml
 
[[email protected] kafkamanager]# kubectl get pods -n wiseco|grep kafkamanager
kafkamanager-6b966689f6-mr9tq                   1/1     Running   0          2m51s
[[email protected] kafkamanager]# kubectl get svc -n wiseco|grep kafkamanager
kafkamanager            NodePort    10.254.240.254   <none>        9000:39921/TCP                   2m55s

3、 ... and 、kafkamanager visit

Use K8S Of nodeport Port access kafkamanager

The logged-in user is :admin

Login password is :[email protected]