Skip to content

Commit

Permalink
Use headless service DNS instead of pod IP for advertised listeners t…
Browse files Browse the repository at this point in the history
…o avoid problems in environments where IPs frequently change (e.g. Kubernetes)
  • Loading branch information
Sebastian Voss committed Feb 17, 2019
1 parent 0b11469 commit e0e1636
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion charts/cp-kafka/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: KAFKA_HEAP_OPTS
value: {{ .Values.heapOptions }}
- name: KAFKA_ZOOKEEPER_CONNECT
Expand Down Expand Up @@ -123,7 +131,7 @@ spec:
- -exc
- |
export KAFKA_BROKER_ID=${HOSTNAME##*-} && \
export KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://${POD_IP}:9092{{ include "cp-kafka.configuration.advertised.listeners" . }} && \
export KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://${POD_NAME}.{{ template "cp-kafka.fullname" . }}-headless.${POD_NAMESPACE}:9092{{ include "cp-kafka.configuration.advertised.listeners" . }} && \
exec /etc/confluent/docker/run
volumeMounts:
{{- $disksPerBroker := .Values.persistence.disksPerBroker | int }}
Expand Down

0 comments on commit e0e1636

Please sign in to comment.