使用helm模板搭建kafka集群

官方文档:https://github.com/bitnami/charts/tree/master/bitnami/kafka

编写values.yaml

image:
  repository: bitnami/kafka
  tag: 2.4.1-debian-10-r12
socketRequestMaxBytes: _1369296128
heapOpts: -Xmx4G -Xms2G
auth:
  enabled: false
  brokerUser: kafka-broker
  brokerPassword: kafka-broker@123
  interBrokerUser: kafka-inter
  interBrokerPassword: kafka-inter@123
  certificatesSecret: kafka-cert
  certificatesPassword: zaq12wsx
externalAccess:
  enabled: true
  service:
    type: NodePort
    domain: 10.8.202.214		#集群的某个主机ip
    nodePorts:
      - 32225
      - 32226
      - 32227
replicaCount: 3
persistence:
  enabled: true
  size: 10Gi
  storageClass: longhorn		#预先搭好的storageClass
zookeeper:
  image:
    repository: bitnami/zookeeper
    tag: 3.6.0-debian-10-r12
  auth:
    enabled: false
  persistence:
    enabled: true
    size: 5Gi
  replicaCount: 3

安装部署

#添加 bitnami 仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

#添加准备好的 jks 文件
kubectl create secret generic kafka-cert --from-file=kafka.keystore.jks=server.keystore.jks --from-file=kafka.truststore.jks=server.truststore.jks -n kafka

#部署 kafak
helm upgrade --install  kafka  bitnami/kafka -n [命名空间] -f values.yml

进入容器内创建标题

bin/kafka-topics.sh --zookeeper 10.43.xx.xxx:2181 --create --topic test --partitions 8 --replication-factor 1

你可能感兴趣的:(DevOps,kafka,docker,zookeeper,运维,devops)