📖 Scenario: You are working in a team that wants to run Kafka on Kubernetes. To make this easier, you will use Strimzi, a tool that helps manage Kafka clusters on Kubernetes.This project will guide you step-by-step to create a Kafka cluster using Strimzi on Kubernetes.
🎯 Goal: Set up a Kafka cluster on Kubernetes using Strimzi by creating the necessary Kubernetes resources step-by-step.
📋 What You'll Learn
Have access to a Kubernetes cluster
kubectl command-line tool installed and configured
Strimzi Operator installed in the Kubernetes cluster
💡 Why This Matters
🌍 Real World
Running Kafka on Kubernetes is common in modern cloud-native applications to handle real-time data streams efficiently.
💼 Career
DevOps engineers and platform engineers often deploy and manage Kafka clusters on Kubernetes using tools like Strimzi.
Progress0 / 4 steps
1
Create a Kafka namespace
Create a Kubernetes namespace called kafka-project using the command kubectl create namespace kafka-project.
Kafka
Hint
Use kubectl create namespace kafka-project to create the namespace.
2
Deploy the Strimzi Kafka Operator
Apply the Strimzi Operator installation YAML in the kafka-project namespace using kubectl apply -f https://strimzi.io/install/latest?namespace=kafka-project -n kafka-project.
Kafka
Hint
Use kubectl apply -f with the Strimzi URL and specify the namespace with -n kafka-project.
3
Create a Kafka cluster custom resource
Create a YAML file named kafka-cluster.yaml with the exact content below to define a Kafka cluster with 1 Kafka broker and 1 Zookeeper node in the kafka-project namespace:
What will be the number of Kafka broker pods created in the Kubernetes cluster?
medium
A. 3
B. 0
C. 6
D. 1
Solution
Step 1: Identify Kafka replicas in YAML
The replicas field under kafka is set to 3, meaning 3 Kafka broker pods.
Step 2: Understand pod creation
Strimzi creates one pod per replica, so 3 Kafka broker pods will be created.
Final Answer:
3 -> Option A
Quick Check:
Kafka replicas = 3 pods [OK]
Hint: Kafka replicas number = Kafka pods count [OK]
Common Mistakes:
Adding Kafka and Zookeeper replicas together
Confusing ephemeral storage with pod count
Assuming default pod count if replicas missing
4. You applied a Kafka cluster YAML with 3 replicas, but only 1 Kafka pod is running. Which of the following is the most likely cause?
medium
A. Kafka storage type is set to ephemeral
B. The YAML file has replicas: 1 under Kafka section
C. Zookeeper replicas are set to 1
D. Strimzi operator is not installed or running
Solution
Step 1: Check Kafka replicas in YAML
If YAML specifies 3 replicas, pod count should be 3, so replicas: 1 is unlikely.
Step 2: Consider Strimzi operator role
Strimzi operator manages Kafka pods. If it is missing or not running, pods won't be created properly.
Final Answer:
Strimzi operator is not installed or running -> Option D
Quick Check:
Operator missing = pods not managed [OK]
Hint: Check Strimzi operator status if pods don't match replicas [OK]
Common Mistakes:
Blaming Zookeeper replicas for Kafka pod count
Thinking ephemeral storage stops pod creation
Assuming YAML replicas value is always correct
5. You want to update your Kafka cluster managed by Strimzi to use persistent storage instead of ephemeral. Which YAML snippet correctly changes the Kafka storage to persistent with 10Gi volume size?
hard
A. storage:
type: persistent-claim
size: 10Gi
B. storage:
type: persistent-claim
volumeClaimTemplate:
spec:
resources:
requests:
storage: 10Gi