How to setup bridge extension using HiveMQ operator
This article explains steps by step details about how to configure bridge extension using the HiveMQ operator
Prerequisites:
k8s version 1.16+ and < 1.25 is installed
Helm version 3 is installed
A running Kubernetes cluster on any environment or providers cloud provider
Instructions
Let's get started with installing the remote hivemq broker
First, create a namespace to install the remote hivemq broker
kubectl ns create <namespace name>
This step is optional.
Createconfigmap
for hivemq license. (You can get this license from the Customer Success team).kubectl create configmap hivemq-license --from-file hivemq4.lic --from-file hivemq4-bridge-extension-valid-until-28-03-2023.elic -n hivemq-1630
Create your custom
values.yaml
to deploy HiveMQ brokerFull values of the HiveMQ operator can be found herehttps://github.com/hivemq/helm-charts/blob/master/charts/hivemq-operator/values.yaml
example of custom
hivemq_values.yaml
hivemq: image: hivemq/hivemq4:k8s-4.9.1 imagePullPolicy: Always cpu: 8 memory: 8Gi nodeCount: "2" logLevel: "INFO" configMaps: - name: hivemq-license path: /opt/hivemq/license ports: - name: "mqtt" port: 1883 expose: true patch: - '[{"op":"add","path":"/spec/selector/hivemq.com~1node-offline","value":"false"},{"op":"add","path":"/metadata/annotations","value":{"service.spec.externalTrafficPolicy":"Local"}}]' - '[{"op":"add","path":"/spec/type","value":"LoadBalancer"}]' - name: "cc" port: 8080 expose: true patch: - '[{"op":"add","path":"/spec/sessionAffinity","value":"ClientIP"}]' monitoring: dedicated: false enabled: true operator: admissionWebhooks: enabled: false
Deploy remote broker
Verify whether the deployment is successful or not
Check the pods status
Check the hivemq logs
If no error is observed in the logs and all pod statuses are Running then this installation is completed.
Install the hivemq broker(with bridge extension)
Create a namespace to install the hivemq broker.
This step is optional. By default HiveMQ extensions only runs for 5 hrs and then get disabled if no valid license is found.
Createconfigmap
for hivemq license and bridge extension license. (You can get these licenses from the Customer Success team).Edit your bridge configuration file and make sure to do the following changes.
Configure your remote host. Following is syntax
Example:
Next, Configure a topic filter to forward incoming publishes from MQTT clients on the bridge broker to the remote broker. You can find detailed information in our documentation.
This step is optional. The HiveMQ Enterprise Bridge Extension can log key activity between the bridge and the remote broker. It is possible to log the following events. You can also add the
<message-log>
configuration to log activities. For more information check here.
Please refer following example.
Create
configmap
for bridge configuration and this will be hivemq values.yaml under extensions block.This step is optional. By default, you will see all the bridge extension-related logs in hivemq.log. You can edit
logback.xml
to get separate logs for the Bridge extension.Edit
logback.xml
to add Appender and logger for bridge extension logs. Please refer following example.create
configmap
for edited logback.xml.configure created
configmap
in your customvalues.yaml
. Please check the following example.
Create your custom
values.yaml
to deploy HiveMQ brokerFull values of the HiveMQ operator can be found herehttps://github.com/hivemq/helm-charts/blob/master/charts/hivemq-operator/values.yaml
example of custom
hivemq_bridge_values.yaml
Deploy hivemq broker
Verify pods and HiveMQ logs to confirm deployment is successful
hivemq.log will have entries about the Bridge extension. Please find below sample log entries.
By default enterprise bridge extension will work for 5 hours and will be disabled automatically if no valid license found.