How to handle failure senario for kafka and zookeeper in kubernetes

3/16/2020

What I have zookeeper setup which is running on server1, server2 and server3 and similarly kafka also running in server1, server2 and server3.

Setup are running in kubernetes.

Problem statement:

  1. In case one zookeeper setup get down entire setup will get down, because kafka is depended to zookeeper. am i right?

  2. If Q1 correct - Is there any way to make setup like if one zookeeper server will get down then kafka should run as it is?

  3. How to expose kafka port in kubernetes setup ?

  4. what is the recommended way to persist data in kubernetes for production server ?

-- MadAboutProgramming
apache-kafka
apache-zookeeper
kubernetes

1 Answer

3/17/2020

I fail to see how Zookeeper questions are related to k8s... But you definitely should set affinity rules such that Zookeeper and Kafka are not on the same physical servers or sharing same disks

If one Zookeeper out of three goes down, you'll end up with a split brain event in that no single Zookeeper knows which should be responsible for leadership. This effectively can crash or corrupt Kafka, yes.

To mitigate that risk, you can choose to run 5 Zookeepers, in which case you can lose up to 3 servers to reach the same state. The Definitive Guide book covers these concepts in the first few chapters

Regarding the other questions - NodePorts and PVCs, generally speaking.

Use one of the popular Kafka Operators on Github and you'll not need to think too hard about setting those properties

You still must manually perform Kafka admin tasks in any installation... You can use extra services like Cruise Control if you want to reduce that workload, though

-- OneCricketeer
Source: StackOverflow