k8s中部署kafka-eagle

1.下载kafka-eagle镜像

docker pull buzhiyun/kafka-eagle

2.部署mysql数据库

mysql.yml

apiVersion: v1kind: PersistentVolumeClaimmetadata:    name: mysql-pv-claim    namespace: infinovaiotspec:    accessModes:       - ReadWriteOnce    resources:        requests:            storage: 30Gi---apiVersion: apps/v1kind: Deploymentmetadata:    name: mysql    namespace: infinovaiotspec:    replicas: 1    selector:        matchLabels:            app: mysql    template:        metadata:          labels:            app: mysql        spec:            containers:            - name: mysql              image: 10.82.13.105/library/mysql:5.6              imagePullPolicy: IfNotPresent              args:              - "--ignore-db-dir=lost+found"              ports:              - containerPort: 3306              env:              - name: POSTGRES_DB                value: "kafka-eagle"              - name: MYSQL_ROOT_PASSWORD                value: "mysql"              volumeMounts:              - name: mysql                mountPath: /var/lib/mysql/kafka-eagle            volumes:            - name: mysql              persistentVolumeClaim:                  claimName: mysql-pv-claim---apiVersion: v1kind: Servicemetadata:  name: tb-mysql  namespace: infinovaiotspec:  type: ClusterIP  selector:    app: mysql  ports:  - port: 3306    name: mysql---apiVersion: v1kind: Servicemetadata:  name: mysql-client  namespace: infinovaiotspec:  type: NodePort  ports:    - port: 3306      targetPort: 3306      nodePort: 30006  selector:    app: mysql---                  

3.部署kafka

kafka部署能够参考:https://github.com/Yolean/kub...

凋谢JMX端口:5555

https://github.com/Yolean/kub...

4.部署kafka-eagle

system-config.properties文件:

####################################### multi zookeeper&kafka cluster list######################################kafka.eagle.zk.cluster.alias=cluster1cluster1.zk.list=zookeeper:2181####################################### zk client thread limit######################################kafka.zk.limit.size=25####################################### kafka eagle webui port######################################kafka.eagle.webui.port=8048####################################### kafka offset storage######################################cluster1.kafka.eagle.offset.storage=kafka####################################### enable kafka metrics######################################kafka.eagle.metrics.charts=truekafka.eagle.sql.fix.error=true####################################### kafka sql topic records max######################################kafka.eagle.sql.topic.records.max=5000####################################### alarm email configure######################################kafka.eagle.mail.enable=falsekafka.eagle.mail.sa=alert_sa@163.comkafka.eagle.mail.username=alert_sa@163.comkafka.eagle.mail.password=mqslimczkdqabbbhkafka.eagle.mail.server.host=smtp.163.comkafka.eagle.mail.server.port=25####################################### alarm im configure#######################################kafka.eagle.im.dingding.enable=true#kafka.eagle.im.dingding.url=https://oapi.dingtalk.com/robot/send?access_token=#kafka.eagle.im.wechat.enable=true#kafka.eagle.im.wechat.token=https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=xxx&corpsecret=xxx#kafka.eagle.im.wechat.url=https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=#kafka.eagle.im.wechat.touser=#kafka.eagle.im.wechat.toparty=#kafka.eagle.im.wechat.totag=#kafka.eagle.im.wechat.agentid=####################################### delete kafka topic token######################################kafka.eagle.topic.token=keadmin####################################### kafka sasl authenticate######################################cluster1.kafka.eagle.sasl.enable=falsecluster1.kafka.eagle.sasl.protocol=SASL_PLAINTEXTcluster1.kafka.eagle.sasl.mechanism=PLAINcluster1.kafka.eagle.sasl.jaas.config=kafka_client_jaas.conf####################################### kafka jdbc driver address#######################################kafka.eagle.driver=org.sqlite.JDBC#kafka.eagle.url=jdbc:sqlite:/usr/local/ke.db#kafka.eagle.username=root#kafka.eagle.password=www.kafka-eagle.orgkafka.eagle.driver=com.mysql.jdbc.Driverkafka.eagle.url=jdbc:mysql://tb-mysql:3306/kafka-eaglekafka.eagle.username=rootkafka.eagle.password=mysql
---apiVersion: apps/v1kind: Deploymentmetadata:  name: kafka-eagle  namespace: infinovaiotspec:  progressDeadlineSeconds: 600  replicas: 1  revisionHistoryLimit: 10  selector:    matchLabels:      workload.user.cattle.io/workloadselector: deployment-kafka-kafka-eagle  strategy:    rollingUpdate:      maxSurge: 1      maxUnavailable: 0    type: RollingUpdate  template:    metadata:      labels:        workload.user.cattle.io/workloadselector: deployment-kafka-kafka-eagle    spec:      containers:      - image: buzhiyun/kafka-eagle:latest        imagePullPolicy: Always        name: kafka-eagle        ports:        - containerPort: 8048          name: 8048tcp01          protocol: TCP        resources: {}        securityContext:          allowPrivilegeEscalation: false          privileged: false          procMount: Default          readOnlyRootFilesystem: false          runAsNonRoot: false        stdin: true        terminationMessagePath: /dev/termination-log        terminationMessagePolicy: File        tty: true        volumeMounts:        - mountPath: /opt/kafka-eagle/conf          name: conf      dnsPolicy: ClusterFirst      restartPolicy: Always      schedulerName: default-scheduler      securityContext: {}      terminationGracePeriodSeconds: 30      volumes:      - configMap:          defaultMode: 256          name: kafka-eagle-config          optional: false        name: conf---apiVersion: v1kind: Servicemetadata:  name: kafka-eagle-client  namespace: infinovaiotspec:  type: NodePort  ports:    - port: 8048      targetPort: 8048      nodePort: 30048  selector:    workload.user.cattle.io/workloadselector: deployment-kafka-kafka-eagle 

kafka_client_jaas.conf

KafkaClient {  org.apache.kafka.common.security.plain.PlainLoginModule required  username="admin"  password="admin-secret";};

别离执行以下命令:

kubectl apply -f mysql.yml

kubectl create configmap kafka-eagle-config -n infinovaiot --from-file=kafka_client_jaas.conf \
--from-file=system-config.properties

kubectl apply -f kafka-eagle.yml

5.浏览器拜访

浏览器输出: http://ip:port30048/ke

账号:admin 明码:123456