Table of Contents |
---|
...
Create a namespace for Kafka and switch the context to it:
Code Block language bash kubectl create namespace kafka;
Code Block kubectl config set-context --current --namespace=kafka
Add the repository for the Kafka Helm chart to your package manager.
Code Block language bash helm repo add bitnami https://charts.bitnami.com/bitnami
Code Block helm repo update
Deploy the Kafka server using the Helm chart.
Additional step with AWS EKS cluster:
You will need to configure the Amazon EBS CSI driver. You can find detailed steps How to configure Amazon EBS CSI driver for working PersistentVolumes in EKSThe below command deploys Kafka with 2 brokers (replicas).
Code Block language bash helm upgrade --install kafka bitnami/kafka --namespace=kafka --set replicaCount=2
Please notice the output of the command above, it provides critical data that is used for the next steps
Consumers can access Kafka via port 9092 on the following DNS name from within your cluster:
kafka.kafka.svc.cluster.local
The CLIENT listener for Kafka client connections from within your cluster has been configured with the following security settings: SASL authentication
To connect a client to your Kafka:
username="user1"
To get the password execute the command below:(skip % at the end)
Code Block language bash kubectl get secret kafka-user-passwords --namespace kafka \ -o jsonpath='{.data.client-passwords}' | base64 -d | cut -d , -f 1;
...
Prepare a simple configuration file for kafka-extension as in the example below.
this example configuration will map all incoming MQTT publish packets to the topic “test” in Kafka; and will map the topic “test” in Kafka to the topic “test” in the HiveMQ broker
Use your password in
<password>here_is_your_password</password>
, that you successfully retrieved with this command a few steps ago:Code Block language bash kubectl get secret kafka-user-passwords --namespace kafka \ -o jsonpath='{.data.client-passwords}' | base64 -d | cut -d , -f 1;
Here is the file:
...