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:

  1. k8s version 1.16+ and < 1.25 is installed

  2. Helm version 3 is installed

  3. A running Kubernetes cluster on any environment or providers cloud provider

 Instructions

  1. Let's get started with installing the remote hivemq broker

    1. First, create a namespace to install the remote hivemq broker

      kubectl ns create <namespace name>
    2. This step is optional.
      Create configmap 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
    3. Create your custom values.yaml to deploy HiveMQ broker

      1. Full values of the HiveMQ operator can be found herehttps://github.com/hivemq/helm-charts/blob/master/charts/hivemq-operator/values.yaml

      2. 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
    4. Deploy remote broker

    5. Verify whether the deployment is successful or not

      1. Check the pods status

      2. Check the hivemq logs

      3. If no error is observed in the logs and all pod statuses are Running then this installation is completed.

  2. Install the hivemq broker(with bridge extension)

    1. Create a namespace to install the hivemq broker.

    2. This step is optional. By default HiveMQ extensions only runs for 5 hrs and then get disabled if no valid license is found.
      Create configmap for hivemq license and bridge extension license. (You can get these licenses from the Customer Success team).

    3. Edit your bridge configuration file and make sure to do the following changes.

      1. Configure your remote host. Following is syntax

        Example:

      2. 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.

      3. 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.

    4. Create configmap for bridge configuration and this will be hivemq values.yaml under extensions block.

    5. 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.

      1. Edit logback.xml to add Appender and logger for bridge extension logs. Please refer following example.

      2. create configmap for edited logback.xml.

      3. configure created configmap in your custom values.yaml. Please check the following example.

    6. Create your custom values.yaml to deploy HiveMQ broker

      1. Full values of the HiveMQ operator can be found herehttps://github.com/hivemq/helm-charts/blob/master/charts/hivemq-operator/values.yaml

      2. example of custom hivemq_bridge_values.yaml

    7. Deploy hivemq broker

    8. Verify pods and HiveMQ logs to confirm deployment is successful

      1. 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.

 Related articles