广告位联系
返回顶部
分享到

详解K8S部署Kafka界面管理工具(kafkamanager)方法

云和虚拟化 来源:互联网 作者:秩名 发布时间:2022-01-30 20:02:07 人浏览
摘要

kafka-manager 是雅虎开源的apache-kafka管理工具,是用Scala编写的,可以在web页面进行kafka的相关操作。 一、制作kafkamanager的image镜像 下载kafka-manager-2.0.0.2.zip,在解压目录的conf下的applicati

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

[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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

[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

创建并查看

1

2

3

4

5

6

[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


版权声明 : 本文内容来源于互联网或用户自行发布贡献,该文观点仅代表原作者本人。本站仅提供信息存储空间服务和不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权, 违法违规的内容, 请发送邮件至2530232025#qq.cn(#换@)举报,一经查实,本站将立刻删除。
原文链接 : https://www.cnblogs.com/kevingrace/p/14412024.html
相关文章
  • kvm 透传显卡至win10虚拟机的方法

    kvm 透传显卡至win10虚拟机的方法
    环境 1 2 3 4 5 6 7 8 9 10 11 已安装nvidia 显卡 驱动 操作系统:CentOS Linux release 7.9.2009 (Core) 内核版本:Linux 5.4.135-1.el7.elrepo.x86_64 显卡 型号:rtx 6000
  • Docker Desktop常见的几种启动失败问题解决方法

    Docker Desktop常见的几种启动失败问题解决方法
    报错1,Error:Failed to restart 点Quit 然后出现提示WSL 2 is not installed 点击 Use Hyper-V 打开 启用或关闭windows功能 确保适用于Linux的Windows子系统和
  • 使用Kubernetes自定义资源(CRD)的介绍
    什么是CRD CRD的全称为CustomResourceDefinitions,即自定义资源。k8s拥有一些内置的资源,比如说Pod,Deployment,ReplicaSet等等,而CRD则提供了一种方
  • 部署k8s集群的实践步骤

    部署k8s集群的实践步骤
    1、部署k8s的两种方式: 目前生产部署Kubernetes集群主要有两种方式: kubeadm Kubeadm是一个K8s部署工具,提供kubeadm init和kubeadm join,用于快速部
  • docker启动jenkins环境的问题介绍

    docker启动jenkins环境的问题介绍
    【注意:】jenkins的docker镜像,需要从官网进入直接获取,其他地方获取到的docker镜像,可能因为Jenkins版本过低,导致后续插件安装失败等问
  • Docker容器搭建Kafka集群的教程

    Docker容器搭建Kafka集群的教程
    一、Kafka集群的搭建 1.拉取相关镜像 1 2 docker pull wurstmeister/kafka docker pull zookeeper 2.运行zookeeper 1 docker run -d --name zookeeper -p 2181:2181 -t zookeeper
  • 详解Docker容器之间数据传输

    详解Docker容器之间数据传输
    1.从容器中将文件拷贝到宿主机上。 在宿主机你想要接收文件的地方,运行下面的指令 1 docker cp 容器id:home/test . 1 2 3 4 5 6 7 8 9 10 11 12 13 14
  • KVM介绍及作用

    KVM介绍及作用
    一、虚拟化 1、背景 美国环境保护EPA报告中曾经统计过一组统计数据:EPA研究服务器和数据中心得能源效率时发现,实际上服务器只有5%得时
  • 碎片拼接技术恢复XenServer服务器SQL Server数据库数

    碎片拼接技术恢复XenServer服务器SQL Server数据库数
    环境:? Dell PowerEdge服务器; XenServer虚拟化平台; 4块希捷2T STAT硬盘用RAID卡组成的RAID10; XenServer虚拟机操作系统:Windows Server系统; 虚拟机
  • Docker私有仓库Harbor介绍和部署方法介绍

    Docker私有仓库Harbor介绍和部署方法介绍
    Docker容器应用的开发和运行离不开可靠的镜像管理,虽然Docker官方也提供了公共的镜像仓库,但是从安全和效率等方面考虑,部署我们私有
  • 本站所有内容来源于互联网或用户自行发布,本站仅提供信息存储空间服务,不拥有版权,不承担法律责任。如有侵犯您的权益,请您联系站长处理!
  • Copyright © 2017-2022 F11.CN All Rights Reserved. F11站长开发者网 版权所有 | 苏ICP备2022031554号-1 | 51LA统计