K8S部署Kafka界面管理工具(kafkamanager)方法詳解
kafka-manager 是雅虎開源的apache-kafka管理工具,是用Scala編寫的,可以在web頁面進(jìn)行kafka的相關(guān)操作。
一、制作kafkamanager的image鏡像
下載kafka-manager-2.0.0.2.zip,在解壓目錄的conf下的application.conf文件里,修改kafka-manager.zkhosts地址和cmake.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
[root@k8s-storage01 kafkamanager]# pwd /home/k8s_deploy/fin/online/deploy/kafkamanager [root@k8s-storage01 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 [root@k8s-storage01 kafkamanager]# unzip kafka-manager-2.0.0.2.zip [root@k8s-storage01 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 [root@k8s-storage01 kafkamanager]# cd kafka-manager-2.0.0.2/conf/ [root@k8s-storage01 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 #這里啟用了用戶密碼登錄,默認(rèn)false不啟用 (除了這里啟用用戶登錄, 后面也可以啟用ldap) basicAuthentication.enabled=${?KAFKA_MANAGER_AUTH_ENABLED} ........... ........... basicAuthentication.username="admin" basicAuthentication.username=${?KAFKA_MANAGER_USERNAME} basicAuthentication.password="AdMin@123" #修改用戶登錄密碼 basicAuthentication.password=${?KAFKA_MANAGER_PASSWORD} ........... ........... 重新打包 [root@k8s-storage01 conf]# cd ../../ [root@k8s-storage01 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 [root@k8s-storage01 kafkamanager]# rm -rf kafka-manager-2.0.0.2.zip [root@k8s-storage01 kafkamanager]# tar -zvcf kafka-manager-2.0.0.2.tar.gz kafka-manager-2.0.0.2 [root@k8s-storage01 kafkamanager]# rm -rf kafka-manager-2.0.0.2 [root@k8s-storage01 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 制作Dockerfile鏡像 [root@k8s-storage01 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"] 上傳到harbor倉庫 [root@k8s-storage01 kafkamanager]# docker build -t 192.168.10.10/wiseco/kafka-manager-2.0.0.2:v1 . [root@k8s-storage01 kafkamanager]# docker push 192.168.10.10/wiseco/kafka-manager-2.0.0.2:v1
二、創(chuàng)建kafkamanager的pod
[root@k8s-master01 kafkamanager]# pwd /opt/k8s/k8s-project/kafka_zk/kafkamanager [root@k8s-master01 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
創(chuàng)建并查看
[root@k8s-master01 kafkamanager]# kubectl apply -f kafkamanager.yaml [root@k8s-master01 kafkamanager]# kubectl get pods -n wiseco|grep kafkamanager kafkamanager-6b966689f6-mr9tq 1/1 Running 0 2m51s [root@k8s-master01 kafkamanager]# kubectl get svc -n wiseco|grep kafkamanager kafkamanager NodePort 10.254.240.254 <none> 9000:39921/TCP 2m55s
三、kafkamanager訪問
使用K8S的nodeport端口訪問kafkamanager
登錄用戶是:admin
登錄密碼是:AdMin@123
更多關(guān)于K8S技術(shù)知識(shí)請(qǐng)查看下面的相關(guān)鏈接
- 在centos 7中安裝配置k8s集群的步驟詳解
- Docker學(xué)習(xí)筆記之k8s部署方法
- Kubernetes(k8s)基礎(chǔ)介紹
- 基于Docker+K8S+GitLab/SVN+Jenkins+Harbor搭建持續(xù)集成交付環(huán)境的詳細(xì)教程
- k8s部署redis cluster集群的實(shí)現(xiàn)
- K8s部署發(fā)布Golang應(yīng)用程序的實(shí)現(xiàn)方法
- Kubernetes(K8S)容器集群管理環(huán)境完整部署詳細(xì)教程-上篇
- Kubernetes(K8S)容器集群管理環(huán)境完整部署詳細(xì)教程-中篇
- Kubernetes(K8S)容器集群管理環(huán)境完整部署詳細(xì)教程-下篇
相關(guān)文章
RFO SIG之openEuler AWS AMI 制作詳解
這篇文章主要為大家介紹了RFO SIG之openEuler AWS AMI 制作詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-10-10Rainbond功能架構(gòu)及應(yīng)用管理官方文檔介紹
這篇文章主要為大家介紹了Rainbond功能機(jī)構(gòu)及使用官方文檔,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-04-04關(guān)于CentOS7日志文件及journalctl日志查看方法
這篇文章主要介紹了關(guān)于CentOS7日志文件及journalctl日志查看方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-03-03kubernetes(k8s)安裝metrics-server實(shí)現(xiàn)資源使用情況監(jiān)控方式詳解
這篇文章主要介紹了kubernetes(k8s)安裝metrics-server實(shí)現(xiàn)資源使用情況監(jiān)控,包括Metrics?Server下載方式,?k8s集群安裝部署metrics的問題,本文給大家介紹的非常詳細(xì),需要的朋友可以參考下2022-04-04ES業(yè)務(wù)數(shù)據(jù)遷移遇到的精度問題BUG
這篇文章主要為大家介紹了ES業(yè)務(wù)數(shù)據(jù)遷移遇到的BUG精度問題,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-06-06Rainbond的ServiceMesh架構(gòu)組件端口沖突處理解決
這篇文章主要大家介紹了Rainbond?ServiceMesh架構(gòu)組件端口沖突處理方式,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-04-04