0
0
Kafkadevops~10 mins

Kafka on Kubernetes (Strimzi) - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Kafka on Kubernetes (Strimzi)
Create Kubernetes Namespace
Apply Strimzi Operator YAML
Operator Installs Kafka Cluster CRDs
Create Kafka Cluster Custom Resource
Operator Deploys Kafka Pods & Services
Kafka Cluster Runs inside Kubernetes
Clients Connect to Kafka via Services
This flow shows how Strimzi operator manages Kafka on Kubernetes: install operator, create Kafka resource, operator deploys Kafka pods, then clients connect.
Execution Sample
Kafka
kubectl create namespace kafka
kubectl apply -f strimzi-cluster-operator.yaml -n kafka
kubectl apply -f kafka-cluster.yaml -n kafka
kubectl get pods -n kafka
Commands to create namespace, install Strimzi operator, deploy Kafka cluster, and check Kafka pods running.
Process Table
StepCommandActionResult/Output
1kubectl create namespace kafkaCreate namespace 'kafka'namespace/kafka created
2kubectl apply -f strimzi-cluster-operator.yaml -n kafkaInstall Strimzi operatordeployment.apps/strimzi-cluster-operator created
3Operator installs Kafka CRDsCustom Resource Definitions addedkafkas.kafka.strimzi.io CRD created
4kubectl apply -f kafka-cluster.yaml -n kafkaCreate Kafka cluster resourcekafka.kafka.strimzi.io/my-cluster created
5Operator deploys Kafka podsKafka pods startingpod/my-cluster-kafka-0 Running pod/my-cluster-kafka-1 Running pod/my-cluster-kafka-2 Running
6kubectl get pods -n kafkaCheck Kafka pods statusNAME READY STATUS RESTARTS AGE my-cluster-kafka-0 1/1 Running 0 2m my-cluster-kafka-1 1/1 Running 0 2m my-cluster-kafka-2 1/1 Running 0 2m
7Kafka cluster readyKafka cluster is runningKafka cluster pods are all Running and Ready
💡 Kafka pods are Running and Ready, cluster is ready for clients
Status Tracker
ResourceInitial StateAfter Step 2After Step 4After Step 5Final State
Namespace 'kafka'Not presentCreatedCreatedCreatedCreated
Strimzi OperatorNot installedInstalledInstalledInstalledInstalled
Kafka CRDsNot presentInstalledInstalledInstalledInstalled
Kafka Cluster ResourceNot presentNot presentCreatedCreatedCreated
Kafka PodsNot presentNot presentNot presentStartingRunning
Key Moments - 3 Insights
Why do we need to create a namespace before installing Strimzi?
The namespace isolates Kafka resources. Step 1 creates it so Strimzi operator and Kafka pods run inside it, as shown in execution_table row 1.
What happens if we apply the Kafka cluster resource before installing Strimzi operator?
The Kafka CRDs won't exist yet, so Kubernetes rejects the Kafka cluster resource. Step 3 shows CRDs must be installed first.
Why do we check pod status after deploying Kafka cluster?
To confirm Kafka pods are running and ready for use. Execution_table rows 5 and 6 show pods transitioning to Running state.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 3. What does the operator install?
AKafka Custom Resource Definitions (CRDs)
BKafka client tools
CKafka pods
DKubernetes namespace
💡 Hint
Check the 'Action' and 'Result/Output' columns at step 3 in execution_table.
At which step do Kafka pods start running?
AStep 2
BStep 4
CStep 5
DStep 7
💡 Hint
Look at the 'Action' and 'Result/Output' columns for pod status in execution_table.
If the namespace 'kafka' was not created, what would happen at step 2?
AOperator installs successfully in default namespace
Bkubectl apply fails because namespace does not exist
CKafka cluster deploys anyway
DPods start running in default namespace
💡 Hint
Refer to variable_tracker for namespace state and execution_table step 1 and 2.
Concept Snapshot
Kafka on Kubernetes with Strimzi:
- Create a Kubernetes namespace for Kafka
- Install Strimzi operator YAML in that namespace
- Operator adds Kafka CRDs to Kubernetes
- Apply Kafka cluster custom resource YAML
- Operator deploys Kafka pods and services
- Check pods are Running before using Kafka
- Clients connect via Kubernetes services
Full Transcript
This visual execution shows how to run Kafka on Kubernetes using Strimzi operator. First, create a namespace called 'kafka' to isolate resources. Then apply the Strimzi operator YAML in that namespace. The operator installs Kafka Custom Resource Definitions (CRDs) into Kubernetes. Next, apply a Kafka cluster custom resource YAML to request a Kafka cluster. The operator sees this and deploys Kafka pods and services inside the namespace. Finally, check the pods are running and ready. Once ready, clients can connect to Kafka through Kubernetes services. This step-by-step flow helps beginners see how Kubernetes and Strimzi work together to run Kafka.