Kafka Operator
date
Jan 15, 2024
slug
kafka-operator
status
Published
tags
Kafka
Kubernete
summary
type
Post
背景
Kafka现状
- Namespace
- ClusterRole: InitContainer内部需要进行集群访问获取一些信息
- ClusterRoleBinding:
- ServiceAccount:
- PVC:
- Secret
- login: 实例维度,kafka_server_jaas配置,SASL认证需要。
- 用户名固定(admin),密码不固定。
- monitor : 实例维度,监控使用。mq-metrics-exporter。
- 用户名固定(monitor),密码不固定。
- ssl:集群维度,用于SSL认证
- Service
- StatefulSet
- ConfigMap : Namespace维度
- 网络相关
- PLB
- Endpoint
实践
strimzi-kafka-operator
koperator
The Koperator (formerly called Banzai Cloud Kafka Operator) is a Kubernetes operator to automate provisioning, management, autoscaling and operations of Apache Kafka clusters deployed to Kubernetes.
组件
- ZooKeeper
- ZK Operator (Helm Chart)
- ZK Broker (Operator)
- Kafka
- Kafka Operator(Helm Chart)
- Kafka Broker(Operator)
CRD
- KafkaCluster
- 属性:
- spec
- .spec.additionalPorts: 暴露端口相关
- .spec.alertManagerConfig: 告警配置
- .spec.envs
- .spec.zkAddresses
- .spec.zkPath
- .spec.listenersConfig: 监听器配置
- .spec.brokers: Broker维度,每个Broker独立的配置
- .spec.brokers[*].brokerConfig: Broker配置
- .spec.brokers[*].brokerConfig.affinity.podAffinity: 节点亲和性配置
- .spec.brokers[*].brokerConfig.affinity.podAntiAffinity: 节点反亲和性配置
- .spec.brokers[*].brokerConfig.brokerAnnotations: 注解
- .spec.brokers[*].brokerConfig.brokerLabels : Label
- .spec.brokers[*].brokerConfig.containers[*] :容器相关配置;容器维度;
- 环境变量;
- envFrom[*].configMapRef
- envFrom[*].secretRef
- 镜像
- image
- imagePullPolicy
- lifecycle: 注册一些生命周期过程中的Hook。
- 健康检查
- livenessProbe
- 基本信息
- name
- ports
- resources:资源规格;limits、requests。
- securityContext:安全上下文
- 存储相关
- volumeDevices[*]: 快设备信息,块设备维度。
- name
- volumeMounts
- volumeMounts[*]:
- mountPath
- name
- .spec.brokers[].brokerConfig.envs[]: Broker Pod种环境变量
- .spec.brokers[*].brokerConfig.image:镜像
- .spec.brokers[*].brokerConfig.initContainers
- .spec.brokers[*].brokerConfig.kafkaHeapOpts
- .spec.brokers[*].brokerConfig.kafkaJvmPerfOpts
- .spec.brokers[*].brokerConfig.networkConfig
- .spec.brokers[*].brokerConfig.resourceRequirements
- .spec.brokers[*].brokerConfig.storageConfigs
- .spec.brokers[].brokerConfig.volumes[]
- KafkaUser
- KafkaTopic
- CruiseControlOperation - 运维操作:新增Broker/移除Broker/数据重均衡
- 在对KafkaCluster做操作时,会生成CruiseControlOperation的CRD,内部有执行的状态
- 支持任务停止、暂停/恢复、重试(可设置重试策略)、执行完成后CRD的自动CleanUp