惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
P
Proofpoint News Feed
Cyberwarzone
Cyberwarzone
C
Cisco Blogs
SecWiki News
SecWiki News
Know Your Adversary
Know Your Adversary
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
NISL@THU
NISL@THU
WordPress大学
WordPress大学
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Threat Research - Cisco Blogs
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
Security Archives - TechRepublic
Security Archives - TechRepublic
有赞技术团队
有赞技术团队
L
LINUX DO - 热门话题
Hacker News: Ask HN
Hacker News: Ask HN
V
V2EX
G
GRAHAM CLULEY
TaoSecurity Blog
TaoSecurity Blog
Hugging Face - Blog
Hugging Face - Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
F
Fortinet All Blogs
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
Latest news
Latest news
The Hacker News
The Hacker News
aimingoo的专栏
aimingoo的专栏
T
Troy Hunt's Blog
S
Schneier on Security
I
Intezer
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threatpost
爱范儿
爱范儿
The Register - Security
The Register - Security
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
宝玉的分享
宝玉的分享
Recent Commits to openclaw:main
Recent Commits to openclaw:main
美团技术团队
B
Blog RSS Feed

博客园 - 散尽浮华

Rancher 证书到期问题处理手册 Rancher部署并导入K8S集群 K8S集群灾备环境部署 K8S容器环境下GitLab-CI和GItLab Runner 部署记录 K8S持久化存储PV、PVC笔记 K8S部署ES集群 - 运维笔记 容器和镜像转化、迁移方式 - 运维小结 K8S部署RabbitMQ集群 (镜像模式) - 部署笔记 Pod滚动重启方法 - 运维笔记 Node节点禁止调度(平滑维护)方式- cordon,drain,delete K8S中NodePort端口范围修改 Centos7.4升级到Centos7.7 K8S部署Redis Cluster集群(三主三从模式) - 部署笔记 K8S部署Nacos集群 - 部署笔记 K8S部署Kafka集群 - 部署笔记 K8S部署RocketMQ集群(双主双从+同步模式) - 部署笔记 Nginx流量拷贝 - 运维笔记 Nginx基于站点目录和文件的URL访问控制 - 配置笔记 Nginx禁止ip访问或非法域名访问 - 配置笔记
K8S部署Kafka界面管理工具(kafkamanager)
散尽浮华 · 2021-02-18 · via 博客园 - 散尽浮华

kafka-manager 是雅虎开源的apache-kafka管理工具,是用Scala编写的,可以在web页面进行kafka的相关操作。

一、制作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       #这里启用了用户密码登录,默认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

二、创建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

创建并查看

[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