Strimzi-Kafka-Operator
Kafka管理Operator-https://github.com/strimzi/strimzi-kafka-operator
部署安装Operator https://strimzi.io/downloads/
部署完成后生成一堆的CRD和一个Controller,基本Operator都是一样套路
此时strimzi-cluster-operator已具备了对以下CRD的操作监管
接下来就是部署Kafka集群了,当前是只能在内部访问的例子
apiVersion: kafka.strimzi.io/v1beta2 kind: Kafka metadata: name: my-cluster spec: kafka: version: 3.4.0 replicas: 2 listeners: - name: plain port: 9092 type: internal tls: false - name: tls port: 9093 type: internal tls: true config: offsets.topic.replication.factor: 1 transaction.state.log.replication.factor: 1 transaction.state.log.min.isr: 1 default.replication.factor: 1 min.insync.replicas: 1 inter.broker.protocol.version: "3.4" storage: type: jbod volumes: - id: 0 type: persistent-claim size: 10Gi class: disk deleteClaim: true zookeeper: replicas: 1 storage: type: persistent-claim size: 10Gi class: disk deleteClaim: true entityOperator: topicOperator: {} userOperator: {}
创建完之后等一会儿,将会看到zk以及若干的容器、服务被创建
两个kafka分片
相关服务
如果需要通过Nodeport访问,listeners修改为以下配置,增加external相关配置
listeners: - name: plain port: 9092 type: internal tls: false - name: tls port: 9093 type: internal tls: true - name: external port: 9094 type: nodeport tls: false configuration: bootstrap: nodePort: 32094
部署后看到相关服务变更
and
这里看到已经生成了对应的Nodeport类型的服务
查看创建的Kafka对象状态,可以看到具体的状态信息
这里可以看到地址列表已经是NodeportIP地址了
-------
切换到Kafka容器内部看下,cat custom-config/server.config
通过advertised.listeners配置对外开放地址端口,这里Nodeport类型对外开放默认地址就是Nodeip
./bin/kafka-run-class.sh org.apache.zookeeper.ZooKeeperMainWithTlsSupportForKafka -server localhost:12181
查看zk broker监听,可以看到external
Nodeport访问IP是通过Operator+kafka自身的advertised.listeners实现的,与前文中redis集群逻辑不同,已经从自身解决了podIP外部不可访问的问题
由于要有状态,所以需要先准备云盘,设置默认存储 kubectl patch storageclass alicloud-disk-ssd -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
其他好文
http://www.javajun.net/posts/55588/
https://blog.csdn.net/weixin_39766667/article/details/128177436
标签:tls,name,Strimzi,kafka,Operator,Kafka,type From: https://www.cnblogs.com/it-worker365/p/17165378.html