Merge pull request #1296 from lewapek/kafka-notes-fix

[bitnami/kafka] Kafka notes fix namespace
This commit is contained in:
Alejandro Moreno
2019-07-19 16:55:29 +02:00
committed by GitHub
2 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: kafka
version: 4.0.1
version: 4.0.2
appVersion: 2.3.0
description: Apache Kafka is a distributed streaming platform.
keywords:
+7 -7
View File
@@ -23,29 +23,29 @@ Kafka can be accessed via port 9092 on the following DNS name from within your c
To create a topic run the following command:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka" -o jsonpath="{.items[0].metadata.name}")
kubectl exec -it $POD_NAME -- kafka-topics.sh --create --zookeeper {{ template "kafka.zookeeper.fullname" . }}:2181 --replication-factor 1 --partitions 1 --topic test
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME -- kafka-topics.sh --create --zookeeper {{ template "kafka.zookeeper.fullname" . }}:2181 --replication-factor 1 --partitions 1 --topic test
To list all the topics run the following command:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka" -o jsonpath="{.items[0].metadata.name}")
kubectl exec -it $POD_NAME -- kafka-topics.sh --list --zookeeper {{ template "kafka.zookeeper.fullname" . }}:2181
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME -- kafka-topics.sh --list --zookeeper {{ template "kafka.zookeeper.fullname" . }}:2181
To start a kafka producer run the following command:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka" -o jsonpath="{.items[0].metadata.name}")
{{- if .Values.auth.enabled }}
kubectl exec -it $POD_NAME -- kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic test --producer.config /opt/bitnami/kafka/conf/producer.properties
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME -- kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic test --producer.config /opt/bitnami/kafka/conf/producer.properties
{{- else }}
kubectl exec -it $POD_NAME -- kafka-console-producer.sh --broker-list localhost:9092 --topic test
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME -- kafka-console-producer.sh --broker-list localhost:9092 --topic test
{{- end }}
To start a kafka consumer run the following command:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka" -o jsonpath="{.items[0].metadata.name}")
{{- if .Values.auth.enabled }}
kubectl exec -it $POD_NAME -- kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic test --consumer.config /opt/bitnami/kafka/conf/consumer.properties
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME -- kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic test --consumer.config /opt/bitnami/kafka/conf/consumer.properties
{{- else }}
kubectl exec -it $POD_NAME -- kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME -- kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
{{- end }}
To connect to your Kafka server from outside the cluster execute the following commands:
@@ -80,7 +80,7 @@ To connect to your Kafka server from outside the cluster execute the following c
You should get the content of that file and write it in your host machine:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka" -o jsonpath="{.items[0].metadata.name}")
kubectl exec -it $POD_NAME -- cat /opt/bitnami/kafka/conf/kafka_jaas.conf >> kafka_jaas.conf
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME -- cat /opt/bitnami/kafka/conf/kafka_jaas.conf >> kafka_jaas.conf
Finally, before using your client you need to export the following env var: