K8S中部署KAFKA集群

作者:李毓

下面演示一下在K8S集群中安装KAFKA集群。前提仍然是前面讲述的已经安装好了K8S集群,并且具备CEPH存储的条件。

一些常用仓库

helm repo add stable http://mirror.azure.cn/kubernetes/charts

helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts

helm repo add aliyuncs https://apphub.aliyuncs.com

helm repo update

添加仓库,由于国外被墙了,我们用阿里云的。

helm repo add aliyuncs https://apphub.aliyuncs.com
helm search repo kafka
NAME                       	CHART VERSION	APP VERSION	DESCRIPTION                                       
aliyuncs/kafka             	7.2.2        	2.4.0      	Apache Kafka is a distributed streaming platform. 

helm pull aliyuncs/kafka

[root@adm-master kafka]# tree
.
├── Chart.lock
├── charts
│   └── zookeeper
│       ├── Chart.yaml
│       ├── README.md
│       ├── templates
│       │   ├── configmap.yaml
│       │   ├── _helpers.tpl
│       │   ├── metrics-deployment.yaml
│       │   ├── metrics-svc.yaml
│       │   ├── NOTES.txt
│       │   ├── poddisruptionbudget.yaml
│       │   ├── secrets.yaml
│       │   ├── serviceaccount.yaml
│       │   ├── servicemonitor.yaml
│       │   ├── statefulset.yaml
│       │   ├── svc-headless.yaml
│       │   └── svc.yaml
│       ├── values-production.yaml
│       └── values.yaml
├── Chart.yaml
├── README.md
├── requirements.lock
├── requirements.yaml
├── templates
│   ├── configmap.yaml
│   ├── _helpers.tpl
│   ├── jmx-configmap.yaml
│   ├── kafka-exporter.yaml
│   ├── kafka-jmx-metrics-svc.yaml
│   ├── kafka-metrics-svc.yaml
│   ├── NOTES.txt
│   ├── poddisruptionbudget.yaml
│   ├── scripts-configmap.yaml
│   ├── secrets.yaml
│   ├── serviceaccount.yaml
│   ├── servicemonitor-jmx-metrics.yaml
│   ├── servicemonitor-metrics.yaml
│   ├── statefulset.yaml
│   ├── svc-external-access.yaml
│   ├── svc-headless.yaml
│   └── svc.yaml
├── values-production.yaml
└── values.yaml

4 directories, 40 files

把 values-production.yaml  values.yaml 的storageClass改成k8s-rbd
一共4个文件,都要改。

helm install kafka . -f ./values.yaml

[root@adm-master kafka]# kubectl get pods,svc
NAME                                         READY   STATUS    RESTARTS   AGE
pod/kafka-0                                  1/1     Running   0          113m
pod/kafka-1                                  1/1     Running   0          57s
pod/kafka-2                                  1/1     Running   0          57s
pod/kafka-zookeeper-0                        1/1     Running   0          87m
pod/kafka-zookeeper-1                        1/1     Running   0          13s
pod/kafka-zookeeper-2                        0/1     Running   0          13s
pod/rbd-provisioner-c968dcb4b-wbhlc          1/1     Running   0          109m

NAME                               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                        AGE
service/kafka                      ClusterIP   10.1.162.141   <none>        9092/TCP                       23h
service/kafka-headless             ClusterIP   None           <none>        9092/TCP                       23h
service/kafka-zookeeper            ClusterIP   10.1.135.217   <none>        2181/TCP,2888/TCP,3888/TCP     23h
service/kafka-zookeeper-headless   ClusterIP   None           <none>        2181/TCP,2888/TCP,3888/TCP     23h
service/kubernetes                 ClusterIP   10.1.0.1       <none>        443/TCP                        230d


安装完成。


上一篇:圆点自动跟随鼠标移动


下一篇:2021-03-07