From 2c4b6cd96dd45d52065431ad97a034d0444100a7 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Tue, 27 Jun 2017 13:08:54 +0200 Subject: [PATCH] Adds probes, but for Kafka I don't think it indicates readiness... which might not matter because we no longer have a loadbalancing service. These probes won't catch all failure modes, but if they fail we're pretty sure the container is malfunctioning. I found some sources recommending ./bin/kafka-topics.sh for probes but to me it looks risky to introduce a dependency to some other service for such things. One such source is https://github.com/kubernetes/charts/pull/144 The zookeeper probe is from https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/ An issue is that zookeeper's logs are quite verbose for every probe. --- 50kafka.yml | 6 ++++++ zookeeper/50pzoo.yml | 12 ++++++++++++ zookeeper/51zoo.yml | 12 ++++++++++++ 3 files changed, 30 insertions(+) diff --git a/50kafka.yml b/50kafka.yml index 4a57f3d3..862cbe0b 100644 --- a/50kafka.yml +++ b/50kafka.yml @@ -47,6 +47,12 @@ spec: requests: cpu: 100m memory: 512Mi + livenessProbe: + exec: + command: + - /bin/sh + - -c + - 'echo "" | nc -w 1 127.0.0.1 9092' volumeMounts: - name: data mountPath: /var/lib/kafka/data diff --git a/zookeeper/50pzoo.yml b/zookeeper/50pzoo.yml index 7b949ce6..c8e35426 100644 --- a/zookeeper/50pzoo.yml +++ b/zookeeper/50pzoo.yml @@ -60,6 +60,18 @@ spec: requests: cpu: 10m memory: 100Mi + livenessProbe: + exec: + command: + - /bin/sh + - -c + - '[ "imok" == $(echo "ruok" | nc -w 1 127.0.0.1 2181) ]' + readinessProbe: + exec: + command: + - /bin/sh + - -c + - '[ "imok" == $(echo "ruok" | nc -w 1 127.0.0.1 2181) ]' volumeMounts: - name: config mountPath: /usr/local/kafka/config diff --git a/zookeeper/51zoo.yml b/zookeeper/51zoo.yml index b73db298..50be93d9 100644 --- a/zookeeper/51zoo.yml +++ b/zookeeper/51zoo.yml @@ -60,6 +60,18 @@ spec: requests: cpu: 10m memory: 100Mi + livenessProbe: + exec: + command: + - /bin/sh + - -c + - '[ "imok" == $(echo "ruok" | nc -w 1 127.0.0.1 2181) ]' + readinessProbe: + exec: + command: + - /bin/sh + - -c + - '[ "imok" == $(echo "ruok" | nc -w 1 127.0.0.1 2181) ]' volumeMounts: - name: config mountPath: /usr/local/kafka/config