Operations 6 min read

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.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Step-by-Step Guide to Installing Zookeeper and Kafka on a Kubernetes 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:3888

Each 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 &

.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Big DataOperationsKubernetesZooKeeperKafkaInstallation
Practical DevOps Architecture
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.