HiveMQ Platform Helm Chart Installation Examples

The following examples show how to customize the deployment of the HiveMQ Platform using the HiveMQ Platform Helm Chart:

Install the HiveMQ Enterprise Extension for Kafka

This example shows you how to deploy a Kubernetes ConfigMap that contains the configuration for the HiveMQ Enterprise Extension for Kafka. The example also shows you how to configure the way the extension is loaded.
For additional information, see the HiveMQ Enterprise Extension for Kafka documentation.

Kafka Extension Configuration

  1. Define the HiveMQ Enterprise Extension for Kafka configuration in a config.xml file:

    <?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>your-kafka-servers:9092</bootstrap-servers>
            </kafka-cluster>
        </kafka-clusters>
        <mqtt-to-kafka-mappings>
            <mqtt-to-kafka-mapping>
                <id>mapping01</id>
                <cluster-id>cluster01</cluster-id>
                <mqtt-topic-filters>
                    <mqtt-topic-filter>data/#</mqtt-topic-filter>
                </mqtt-topic-filters>
                <kafka-topic>your-kafka-topic</kafka-topic>
            </mqtt-to-kafka-mapping>
        </mqtt-to-kafka-mappings>
    </kafka-configuration>
  2. Deploy the config.xml file as a Kubernetes ConfigMap:

    kubectl create configmap kafka-configuration -n <namespace> --from-file=config.xml
  3. Add the following section to your HiveMQ Platform platform-values.yaml configuration file:

    extensions:
      - name: hivemq-kafka-extension
        extensionUri: preinstalled
        enabled: true
        supportsHotReload: true
        configMapName: "kafka-configuration"
  4. Install the HiveMQ Platform:

    helm upgrade -i <your-hivemq-platform> hivemq/hivemq-platform -f platform-values.yaml
  5. The HiveMQ platform is deployed into your Kubernetes environment and the Kafka Extension starts with the specified configuration..

Install a custom JDBC driver for the HiveMQ Enterprise Security Extension

Since HiveMQ 4.26, the HiveMQ Enterprise Security Extension ships with default JDBC drivers.
For specific use-cases, it is possible override the default drivers and install a custom JDBC driver.

This example shows how to use a Kubernetes InitContainer to download a specific driver and install the driver with the Enterprise Security Extension. For additional information, see the HiveMQ Enterprise Security Extension documentation.

Configuration

  1. Create an init-container-jdbc.yaml file with the following text:

    - name: download-mysql-driver
      image: busybox
      command: [ 'sh', '-c', 'wget -P /jdbc-driver https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.30/mysql-connector-java-8.0.30.jar' ]
      volumeMounts:
        - name: jdbc-driver-volume
          mountPath: /jdbc-driver
    Make sure that you download the appropriate version for the driver and check the HiveMQ Enterprise Security Extension documentation for supported drivers.
  2. Add the following section to your HiveMQ Platform platform-values.yaml configuration:

    additionalVolumes:
      - type: emptyDir
        mountName: jdbc-driver-volume
        path: /opt/hivemq/extensions/hivemq-enterprise-security-extension/drivers/jdbc
  3. Install the HiveMQ Platform with the HiveMQ Platform Helm Chart:

    helm upgrade -i <your-hivemq-platform> hivemq/hivemq-platform -f platform-values.yaml --set-file config.overrideInitContainers=init-container-jdbc.yaml
  4. The specified driver is now be available.

Install the HiveMQ Enterprise Extension for Google Cloud Pub/Sub

The following example shows how to deploy a Kubernetes ConfigMap that contains the configuration for the HiveMQ Enterprise Extension for Google Cloud Pub/Sub. The example also shows you how to configure the way the extension is loaded.
For additional information, see the HiveMQ Enterprise Extension for Google Cloud Pub/Sub documentation.

Requirements

Configuration

  1. Define the HiveMQ Enterprise Extension for Google Pub/Sub configuration as a config.xml file:

    <?xml version="1.0" encoding="UTF-8" ?>
    <hivemq-google-cloud-pubsub-extension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd">
        <pubsub-connections>
            <pubsub-connection>
                <id>connection01</id>
                <google-cloud-project-id>your-gcp-project</google-cloud-project-id>
                <authentication>
                    <service-account>
                        <file-path>/opt/hivemq/extensions/hivemq-google-cloud-pubsub-extension/google/pubsub-credentials.json</file-path>
                    </service-account>
                </authentication>
            </pubsub-connection>
        </pubsub-connections>
    
        <mqtt-to-pubsub-mappings>
            <mqtt-to-pubsub-mapping>
                <id>mapping-01</id>
                <pubsub-connection>connection01</pubsub-connection>
                <mqtt-topic-filters>
                    <mqtt-topic-filter>#</mqtt-topic-filter>
                </mqtt-topic-filters>
                <pubsub-topics>
                    <pubsub-topic>
                        <name>your-pubsub-topic</name>
                    </pubsub-topic>
                </pubsub-topics>
            </mqtt-to-pubsub-mapping>
        </mqtt-to-pubsub-mappings>
    
    </hivemq-google-cloud-pubsub-extension>
    Check the HiveMQ Enterprise Extension for Google Cloud Pub/Sub documentation for details on available configuration options.
  2. Deploy the configuration as a Kubernetes ConfigMap:

    kubectl create configmap pubsub-configuration -n <namespace> --from-file=config.xml
  3. Add the following section to your HiveMQ Platform platform-values.yaml configuration file:

    extensions:
       - name: hivemq-google-cloud-pubsub-extension
         extensionUri: preinstalled
         enabled: true
         supportsHotReload: true
         configMapName: "pubsub-configuration"
  4. Create a Kubernetes secret that contains the Google Cloud Pub/Sub credentials as a file:

    kubectl create secret generic pubsub-credentials --from-file=pubsub-credentials.json
  5. Add the following section to your HiveMQ Platform platform-values.yaml configuration:

    additionalVolumes:
      - type: secret
        name: pubsub-credentials
        mountName: credentials-volume
        path: /opt/hivemq/extensions/hivemq-google-cloud-pubsub-extension/google
  6. Install the HiveMQ Platform with the HiveMQ Platform Helm Chart:

    helm upgrade -i <your-hivemq-platform> hivemq/hivemq-platform -f platform-values.yaml
  7. The HiveMQ Platform is deployed to your Kubernetes environment and the HiveMQ Enterprise Extension for Google Cloud Pub/Sub is loaded with the specified configuration.