Strimzi
Installation with Helm
#helm repo add strimzi https://strimzi.io/charts/
#helm search repo strimzi
# Download the chart
open https://github.com/strimzi/strimzi-kafka-operator/releases # strimzi-kafka-operator-helm-3-chart-0.19.0.tgz
# Create the namespace for the kafka cluster operator
kubectl create ns strimzi
# Install the chart
helm install strimzi ./strimzi-kafka-operator --namespace strimzi
# List all charts
helm list -n strimzi
Installation
# Create kafka namespace
kubectl create namespace kafka
# Deploy the CRDs and the Strimzi operator. The CRD extends the K8S API and allows us to custom objects and the operator deploys these objects
kubectl apply -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka
# Deply the cluster (Kafka + Zookeeper). The strimzi operator will see the CRDs and deploy it
kubectl apply -f https://strimzi.io/examples/latest/kafka/kafka-persistent-single.yaml -n kafka
# Wait kafka to startup completely
kubectl wait kafka/my-cluster --for=condition=Ready --timeout=300s -n kafka
# Show Kafka clusters
kubectl get kafka
kubectl get kafka -o yaml
# Simple producer
kubectl -n kafka run kafka-producer -ti --image=strimzi/kafka:0.19.0-kafka-2.5.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --broker-list my-cluster-kafka-bootstrap:9092 --topic my-topic
# Simple consumer
kubectl -n kafka run kafka-consumer -ti --image=strimzi/kafka:0.19.0-kafka-2.5.0 --rm=true --restart=Never -- bin/kafka-console-consumer.sh --bootstrap-server my-cluster-kafka-bootstrap:9092 --topic my-topic --from-beginning
Why run Kafka on Kubernetes
- Kafka is distributed by nature
- Workloads in kafka are also distributed and scalable
- Strimzi provide CRD to make a k8s experience for kafka
Kafka CRDs
- kafkabridges: kb
- kafkaconnectors: kctr
- kafkaconnects: kc
- kafkaconnects2is: kcs2i
- kafkamirrormaker2s: kmm2
- kafkamirrormakers: kmm
- kafkarebalances: kr
- kafkas: k
- kafkatopics: kt
- kafkausers: ku