Skip to content

Commit 198666d

Browse files
authored
Merge pull request #207 from Yolean/kafka-stop-hook
Send Kafka a TERM signal at pod stop and wait for shutdown
2 parents 727899a + 72ca76d commit 198666d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

kafka/50kafka.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ spec:
5858
command:
5959
- ./bin/kafka-server-start.sh
6060
- /etc/kafka/server.properties
61+
lifecycle:
62+
preStop:
63+
exec:
64+
command: ["sh", "-ce", "kill -s TERM 1; while $(kill -0 1 2>/dev/null); do sleep 1; done"]
6165
resources:
6266
requests:
6367
cpu: 100m

zookeeper/50pzoo.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ spec:
4040
command:
4141
- ./bin/zookeeper-server-start.sh
4242
- /etc/kafka/zookeeper.properties
43+
lifecycle:
44+
preStop:
45+
exec:
46+
command: ["sh", "-ce", "kill -s TERM 1; while $(kill -0 1 2>/dev/null); do sleep 1; done"]
4347
ports:
4448
- containerPort: 2181
4549
name: client

zookeeper/51zoo.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ spec:
4343
command:
4444
- ./bin/zookeeper-server-start.sh
4545
- /etc/kafka/zookeeper.properties
46+
lifecycle:
47+
preStop:
48+
exec:
49+
command: ["sh", "-ce", "kill -s TERM 1; while $(kill -0 1 2>/dev/null); do sleep 1; done"]
4650
ports:
4751
- containerPort: 2181
4852
name: client

0 commit comments

Comments
 (0)