kubectl apply -f namespace.yml
kubectl apply -f pv.yml
helm repo add incubator https://charts.helm.sh/incubator
curl https://raw.githubusercontent.com/helm/charts/master/incubator/kafka/values.yaml > values.yaml
helm install kafka-demo --namespace kafka incubator/kafka -f values.yaml --debug
kubectl apply -f testclient
kubectl -n kafka exec -ti testclient -- ./bin/kafka-topics.sh --zookeeper kafka-demo-zookeeper:2181 --topic messages --create --partitions 1 --replication-factor 1
output
Created topic "messages".
Here we need to use the correct hostname for zookeeper cluster and the topic configuration. Next, verify that the topic exists:
kubectl -n kafka exec -ti testclient -- ./bin/kafka-topics.sh --zookeeper kafka-demo-zookeeper:2181 --list
output
Messages
kubectl -n kafka exec -ti testclient -- ./bin/kafka-console-consumer.sh --bootstrap-server kafka-demo:9092 --topic messages --from-beginning
Then create the producer session and type some messages. You will be able to see them propagate to the consumer sessions:
kubectl -n kafka exec -ti testclient -- ./bin/kafka-console-producer.sh --broker-list kafka-demo:9092 --topic messages