Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy Kafka interface management tools for K8S

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to deploy Kafka interface management tools for K8S". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Kafka-manager is Yahoo's open source apache-kafka management tool, which is written in Scala and can be used for kafka-related operations on web pages.

1. Create an image image of kafkamanager

Download kafka-manager-2.0.0.2.zip, and in the application.conf file under the conf of the decompressed directory, change the kafka-manager.zkhosts address and cmake.zkhosts address to:

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] # lltotal 59228 kafka-manager-2.0.0.2.zip [root@k8s-storage01 kafkamanager] # unzip kafka-manager-2.0.0.2.zip [root@k8s-storage01 kafkamanager] 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 # lltotal 59228 lltotal RW Jan 27 17:42 Dockerfiledrwxr-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 ".. basic authentication.enabled = true # user password login is enabled here Default false is not enabled (except for enabling user login here You can also enable ldap) basicAuthentication.enabled=$ {? KAFKA_MANAGER_AUTH_ENABLED}.. basicAuthentication. Username = "admin" basicAuthentication.username=$ {? KAFKA_MANAGER_USERNAME} basicAuthentication.password= "AdMin@123" # modify the user login password basicAuthentication.password=$ {? username}.. Repackage [root@k8s-storage01 conf] # cd. /.. / [root@k8s-storage01 kafkamanager] # lltotal 59228 root root [root@k8s-storage01 kafkamanager] # rm-1 root root 353 Jan 27 17:42 Dockerfiledrwxr-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 -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] # lltotal 58000 Muhashi 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 Image [root@k8s-storage01 kafkamanager] # cat DockerfileFROM 192.168.10.10/wiseco/jdk1.8.0_192RUN 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 9000CMD ["/ opt/kafka-manager/bin/kafka-manager"] uploaded to harbor warehouse [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 II. Create kafkamanager pod [root @ k8s-master01 kafkamanager] # pwd/opt/k8s/k8s-project/kafka_zk/ Kafkamanager [root @ k8s-master01 kafkamanager] # cat kafkamanager.yamlapiVersion: v1kind: Servicemetadata: name: kafkamanager namespace: wiseco labels: app: kafkamanagerspec: type: app: kafkamanager ports:-name: http port: 9000 targetPort: 9000 nodePort: 39921---apiVersion: apps/v1kind: Deploymentmetadata: name: kafkamanager namespace: wisecospec: 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

[root@k8s-master01 kafkamanager] # kubectl apply-f kafkamanager.yaml [root@k8s-master01 kafkamanager] # kubectl get pods-n wiseco | grep kafkamanagerkafkamanager-6b966689f6-mr9tq 1 Running 0 2m51s [root@k8s-master01 kafkamanager] # kubectl get svc-n wiseco | grep kafkamanagerkafkamanager NodePort 10.254.240.254 9000:39921/TCP 2m55s III. Kafkamanager access

Use the nodeport port of K8S to access kafkamanager

The login user is: admin

Login password is: AdMin@123

This is the end of the content of "how to deploy Kafka interface management tools for K8S". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report