Skip to content

How to deploy Kafka in Kubernetes with Helm chart + kafdrop

Last updated on May 29, 2023

Helm provides a quick way of setting up a Redis cluster using a pre-made Helm chart.

1. Add the Helm repository containing the Kafka chart you wish to install.I will use for this tutorial bitnami repo.

helm repo add bitnami https://charts.bitnami.com/bitnami

2. Update local Helm repositories.

helm repo update

3. Use helm install to install the chart. The basic command is as follows:

helm install my-release bitnami/kafka

In short time kafka chart will be deployed and you will see 2 pods (Kafka and zookeeper) up and running. You can check it with command

kubectl get pods

You should see status Running

Now let’s deploy kafdrop – Kafdrop is a UI for monitoring Apache Kafka clusters.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kafdrop
  labels:
    app: kafdrop
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kafka-1663660788 #name of deployed kafka service
  template:
    metadata:
      labels:
        app: kafka-1663660788 #name of deployed kafka service
    spec:
      containers:
      - name: kafdrop
        image: obsidiandynamics/kafdrop:latest
        ports:
        - containerPort: 9000
        env:
        - name: KAFKA_BROKERCONNECT
        value: "kafka-1663660788:9092" #name of deployed kafka service

---
apiVersion: v1
kind: Service
metadata:
  name: kafdrop
  labels:
  name: kafdrop
spec:
  ports:
  - port: 9000
  targetPort: 9000
  name: kafdrop
  protocol: TCP
selector:
  app: kafka-1663660788 #name of deployed kafka service
type: LoadBalancer

Deploy kafdrop with :

kubectl apply -f kafdrop.yaml

Now you can access kafdrop in your browser with http://localhost:9000

Published inAutomationKubernetesLinux