我尝试用configmap在kafka yaml文件中对kafka集群配置。
kafka用的镜像是bitnami/kafka:v2.5.0
,linux系统centos 7.0,zk用的系统镜像3.6.3。
configmap 配置如下:
apiVersion: v1
kind: ConfigMap
metadata:
name: kafka-config
namespace: kafka
data:
server.properties: |
broker.id=${HOSTNAME##*-}
listeners=PLAINTEXT://:9092
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
message.max.bytes=41943040
replica.fetch.max.bytes=41943040
fetch.message.max.bytes=41943040
log.dirs=/data/kafka/logs
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
zookeeper.connect=zk1:2181
zookeeper.connection.timeout.ms=18000
group.initial.rebalance.delay.ms=0
在kafka deployment中引用的部分如下:
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
nodeName: kafka-pod-123
hostname: kafka-pod-123
volumes:
- name: config-volume
configMap:
name: kafka-config
containers:
- name: kafka-VAR_KF_ID
image: hbp/bitnami/kafka:2.5.0
ports:
- containerPort: 9092
volumeMounts:
- name: config-volume
mountPath: /configmap/config
部署完kafka集群进入其中一个容器后,发现kafka集群启动配置并没有被覆盖,但configmap确实在容器中存在了,请问这是什么原因呢?另外感觉kafka集群启动配置(蓝色框示)比之前配置少了很多,这是configmap的缘故吗?求解,谢谢~