Step-by-Step Guide to Installing Zookeeper and Kafka on a Kubernetes Cluster
This tutorial walks through preparing three Kubernetes nodes, extracting and distributing Zookeeper, configuring its zoo.cfg and myid files, starting and verifying the Zookeeper ensemble, then installing Kafka, adjusting its server.properties, and finally launching Kafka across the cluster.
First, the three nodes (192.168.20.40 k8s-master, 192.168.20.43 k8s-node2, 192.168.20.39 k8s-node3) are prepared for Zookeeper installation.
On the master node the Zookeeper tarball is extracted, moved to /data/zookeeper, and copied to the two worker nodes via scp -r zookeeper [email protected]:/data/ and scp -r zookeeper [email protected]:/data/.
The configuration directory is created, the sample config is backed up and renamed to zoo.cfg, then edited to set parameters such as tickTime=2000, dataDir=/data/zookeeper/data/zookeeper, clientPort=2181, and the server list:
server.1=192.168.20.40:2888:3888
server.2=192.168.20.43:2888:3888
server.3=192.168.20.39:2888:3888Each node creates its own myid file (1, 2, 3 respectively) under /data/zookeeper/data/zookeeper.
Zookeeper is started with /data/zookeeper/bin/zkServer.sh start and its status verified on all three nodes, showing one leader and two followers.
Next, Kafka is installed by extracting the tarball, moving it to /data/kafka, and backing up the default server.properties. The file is edited to set broker.id=0, listeners, log directories, and the Zookeeper connection string
zookeeper.connect=192.168.20.40:2181,192.168.20.43:2181,192.168.20.39:2181. The same changes (different broker.id and listeners) are applied to the other two nodes.
Kafka is launched in the background with
nohup /data/kafka/bin/kafka-server-start.sh /data/kafka/config/server.properties >/dev/null 2>&1 &.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
