From ebc504201b6c3218283b5bb8978263a1ef5d0adf Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sat, 25 Apr 2020 11:35:27 +0200 Subject: [PATCH] Breaking: renames the statefulset's headless service so the pod name or statefulset.kubernetes.io/pod-name can be used via the downward api in args to do things like --override listeners=PLAINTEXT://$(POD_NAME).kafka:9092 Once again it's unfortunate that the statefulset label is pod name, not pod index. Also makes sure that DNS entries are published prior to readiness so clusters don't get into loops of not being able to find each other. --- kafka/20dns.yml | 5 ++++- kafka/50kafka.yml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kafka/20dns.yml b/kafka/20dns.yml index 4088c311..3a74b708 100644 --- a/kafka/20dns.yml +++ b/kafka/20dns.yml @@ -3,9 +3,12 @@ apiVersion: v1 kind: Service metadata: - name: broker + name: kafka namespace: kafka + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" spec: + publishNotReadyAddresses: true ports: - port: 9092 # [podname].broker.kafka.svc.cluster.local diff --git a/kafka/50kafka.yml b/kafka/50kafka.yml index 75c9afd5..990ebcf1 100644 --- a/kafka/50kafka.yml +++ b/kafka/50kafka.yml @@ -7,7 +7,7 @@ spec: selector: matchLabels: app: kafka - serviceName: "broker" + serviceName: "kafka" replicas: 3 updateStrategy: type: RollingUpdate