Setting Up Enterprise Kafka Extension with HiveMQ Platform Operator
This guide provides detailed steps for configuring the Enterprise Kafka Extension with the HiveMQ Platform Operator. Ensure you meet the specified prerequisites before proceeding.
Prerequisites:
Helm version v3+
Running Kubernetes cluster version 1.18.0 or higher
kubectl latest version
Instructions
Setup Kafka cluster: (This step is optional if you already have a running Kafka cluster).
Create a namespace for Kafka and switch the context to it:
kubectl create namespace kafka;
kubectl config set-context --current --namespace=kafka
Add the repository for the Kafka Helm chart to your package manager.
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
Deploy the Kafka server using the Helm chart.
The below command deploys Kafka with 2 brokers (replicas).
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)
kubectl get secret kafka-user-passwords --namespace kafka \ -o jsonpath='{.data.client-passwords}' | base64 -d | cut -d , -f 1;
Deploy HiveMQ with Kafka extension
Create a namespace for HiveMQ installation and switch the context to it:
kubectl create namespace hivemq;
kubectl config set-context --current --namespace=hivemq
Generate hivemq_values.yaml:
Deploy HiveMQ using the HiveMQ Platform and generate the
hivemq_values.yaml
file:helm show values hivemq/hivemq-platform > hivemq_values.yaml
Configure Kafka extension License:
Follow the specific steps outlined for configuring the HiveMQ and Kafka extension license. Setting Up HiveMQ License for Your HiveMQ Cluster using HiveMQ Platform Operator
Create config.xml for Kafka extension:
Examples of the
config.xml
file are in the extension folder underconf/examples
.Configure the
username
andpassword
for successful authentication to your Kafka cluster.If you have followed our guide to deploy Kafka cluster then use the username as “user1” and password you copied from the step.
Configure the
<mqtt-to-kafka-mappings>
or<kafka-to-mqtt-mappings>
or<kafka-to-mqtt-transformers>
or<mqtt-to-kafka-transformers>
based on your need.Please refer to the example:
<?xml version="1.0" encoding="UTF-8" ?> <kafka-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd"> <kafka-clusters> <kafka-cluster> <id>cluster01</id> <bootstrap-servers>kafka.kafka.svc.cluster.local:9092</bootstrap-servers> <authentication> <scram-sha256> <username>user1</username> <password>here_is_your_password</password> </scram-sha256> </authentication> </kafka-cluster> </kafka-clusters>