readme.md 1.6 KB

Kafka

failed/ contains my first failed attempt.

  • I think I was following this
  • First issue is that I had to replace the zookeeper ip in kafka2, but even after, there were resolution issues.

Strimzi

Seems like a reasonable way to do it.

Quickstart (unfortunately not for microk8s)

kubectl create namespace kafka
curl -o 1.strimzi.yaml 'https://strimzi.io/install/latest?namespace=kafka'
kubectl create -f 1.strimzi.yaml -n kafka
# See quickstart for some ways to watch it deploy
curl -o 2.single.yaml 'https://strimzi.io/examples/latest/kafka/kafka-persistent-single.yaml'
# Edited and changed to mbox-cluster
kubectl apply -f 2.single.yaml -n kafka
kubectl wait kafka/mbox-cluster --for=condition=Ready --timeout=300s -n kafka 
# Lots of errors in logs, but it settles.

Test with a producer:

# Shell 1: producer
kubectl -n kafka run kafka-producer -ti --image=quay.io/strimzi/kafka:0.35.1-kafka-3.4.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --bootstrap-server mbox-cluster-kafka-bootstrap:9092 --topic my-topic
# Shell 2: Consumer
kubectl -n kafka run kafka-consumer -ti --image=quay.io/strimzi/kafka:0.35.1-kafka-3.4.0 --rm=true --restart=Never -- bin/kafka-console-consumer.sh --bootstrap-server mbox-cluster-kafka-bootstrap:9092 --topic my-topic --from-beginning

Awesome.

Delete everything:

kubectl -n kafka delete $(kubectl get strimzi -o name -n kafka)
kubectl delete -f 1.strimzi.yaml -n kafka