fix Kafka config mount: use /opt/kafka/config/ path instead of /etc/kafka

/etc/kafka doesn't exist in the apache/kafka image - subPath could not
create the parent directory. Switch to /opt/kafka/config/ which exists
in the image, avoiding both the directory conflict and the missing path.
This commit is contained in:
Hermes Agent 2026-05-26 00:16:42 +00:00
parent 5ab0098e34
commit 68033faf4e

View file

@ -82,8 +82,8 @@ spec:
- -c - -c
- | - |
export KAFKA_CLUSTER_ID="$(/opt/kafka/bin/kafka-storage.sh random-uuid)" export KAFKA_CLUSTER_ID="$(/opt/kafka/bin/kafka-storage.sh random-uuid)"
/opt/kafka/bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c /etc/kafka/server.properties --ignore-formatted /opt/kafka/bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c /opt/kafka/config/server.properties --ignore-formatted
exec /opt/kafka/bin/kafka-server-start.sh /etc/kafka/server.properties exec /opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
resources: resources:
requests: requests:
cpu: 250m cpu: 250m
@ -99,7 +99,7 @@ spec:
- ALL - ALL
volumeMounts: volumeMounts:
- name: config - name: config
mountPath: /etc/kafka/server.properties mountPath: /opt/kafka/config/server.properties
subPath: server.properties subPath: server.properties
- name: data - name: data
mountPath: /var/lib/kafka/data mountPath: /var/lib/kafka/data