Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Helm version v3+

  2. Running Kubernetes cluster version 1.18.0 or higher

  3. kubectl latest version

Info

When utilizing the Platform Operator, the default location for the config.xml file is '/opt/hivemq/conf-k8s/config.xml'. To confirm any modifications made after overriding the config.xml, please inspect this directory. This is where you can validate and ensure that the changes have been successfully applied to the configuration.


\uD83D\uDCD8 Instructions

Ensure Proper Configurations:
To run HiveMQ without encountering errors, verify that your config.xml file includes all the necessary configurations.

...

Updating Existing Deployment:

  1. If you have an active HiveMQ deployment and wish to make adjustments, use the following command to retrieve the currently deployed config.xml:

    Code Block
    languagebash
    kubectl describe configmap hivemq-configuration-<installation name> -n <namespace> | grep config.xml

    Replace <installation name> with the actual installation name and <namespace> with the Kubernetes namespace.

  2. You can also get it from hivemq pod, File is located at/opt/hivemq/conf/k8s/config.xml

Starting Fresh:
If you are starting a new HiveMQ deployment, obtain the template with the following command. Copy the contents of config.xml from the generated template and apply the necessary modifications:

...

languagebash

...

In the HiveMQ Platform Helm chart, it is possible to override the default HiveMQ config.xml from a config map.

  1. Prepare the config map manifest, hivemq-configuration-override.yml. Note that the config map contains two keys: config.xml and tracing.xml.

    Code Block
    languageyaml
    # Source: hivemq-platform/templates/hivemq-configuration.yml
    
    | grep config.xml

    Adjust the installation name and namespace as needed. After editing config.xml, implement the updated configuration to your HiveMQ deployment.

    Edit the config.xml file for the adding configurations. For instance, let's set max-queue-size:

    Code Block
    languagexml
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: hivemq-configuration-broker-override
      namespace: hivemq
    data:
      # noinspection XmlPathReference
      config.xml: |-
        <?xml version="1.0"?>
        <hivemq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd">
          <mqtt><listeners>
            <queued-messages>
     <tcp-listener>
              <port>1883</port>
              <max-queue-size>500</max-queue-size><bind-address>0.0.0.0</bind-address>
            </tcp-listener>
            <tls-websocket-listener>
                <strategy>discard</strategy><port>8000</port>
                </queued-messages><bind-address>0.0.0.0</bind-address>
                </mqtt><path>/mqtt</path>
                <tls>
          <listeners>         <tcp-listener> <keystore>
             <port>1883</port>           <bind-address>0.0.0.0</bind-address><path>/path/to/broker-keystore.jks</path>
                        </tcp-listener><password>${ENV:BROKER_KEYSTORE_PASS}</password>
                        <websocket-listener><private-key-password>${ENV:BROKER_KEY_PASSPHRASE}</private-key-password>
                    <port>8001</port></keystore>
                    <bind-address>0.0.0.0</bind-address><client-authentication-mode>NONE</client-authentication-mode>
                </tls>
            </tls-websocket-listener>
          </listeners>
          <cluster>
            <transport>
              <tcp>
                <bind-address>0.0.0.0</bind-address>
                <bind-port>7000</bind-port>
              </tcp>
            </transport>
            <enabled>true</enabled>
            <discovery>
              <extension/>
            </discovery>
          </cluster>
          <!-- required and should not be configured different -->
          <health-api>
            <enabled>true</enabled>
            <listeners>
              <http>
                <port>8889</port>
                <bind-address>0.0.0.0</bind-address>
              </http>
            </listeners>
          </health-api>
        
     <!-- -->
          <control-center>
            <listeners>
              <http>
                <port>8080</port>
                <bind-address>0.0.0.0</bind-address>
              </http>
            </listeners>
          </control-center>
        </hivemq>
      tracing.xml: |-
        <?xml version="1.0" encoding="UTF-8" ?>
        <tracing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="tracing.xsd">
          <context-propagation>
          <anonymous  <outbound-usagecontext-statistics>propagation>
              <enabled>false</enabled>
            </anonymousoutbound-usagecontext-statistics>propagation>
          </hivemq>

    You have two options to override HiveMQ's configuration.

  2. Option 1: Using overrideHiveMQConfig in Helm:

    Code Block
    languagebash
    helm upgrade --install -f hivemq_values.yaml <installation name> hivemq/hivemq-platform --set-file config.overrideHiveMQConfig=config.xml -n <namespace>
  3. Option 2: Using ConfigMap: Create a ConfigMap using the config.xml file:
    context-propagation>
          <sampling>
            <publish-sampling>
              <enabled>true</enabled>
            </publish-sampling>
          </sampling>
        </tracing>
  4. Create the config map.

    Code Block
    languagebash
    kubectl 
    create
    apply 
    configmap
    -f hivemq-configuration
    --from-file config.xml -n <namespace>Edit hivemq_
    -override.yml --namespace hivemq
  5. Update the HiveMQ Platform values.yaml, disable to

    add the ConfigMap name and set create to false:

    create the config map (create: false), and specify the new name of the config map (name: "hivemq-configuration-broker-override").

    Code Block
    languageyaml
    ...
    config:
      
    create: false
      
    name: "hivemq-configuration

    Check Pod Status:

    Verify that all hivemq pods are running.

    Code Block
    -broker-override"
      overrideHiveMQConfig: ""
      overrideStatefulSet: ""
      overrideInitContainers: ""
  6. Update the HiveMQ Platform.

    Code Block
    languageyaml
    helm upgrade broker --install hivemq/hivemq-platform --values values.yaml

    Specify the updated in the step 3 values.yaml in the --values values.yaml

  7. Check the broker pods status and ensure that all pods are running and all containers are ready.

    Code Block
    languagebash
    kubectl get pods -n <namespace>

    Verify log:

    Check
    --namespace hivemq -o wide 
  8. Review the content of the config.xml file on the broker pod and make sure that it is overridden:

    Code Block
    languagebash
    kubectl exec broker-0 -c hivemq -- cat conf-k8s/config.xml
  9. Review the hivemq.log to confirm that config.xml is loaded successfully.

    Code Block
    kubectl logs <pod name> -n <namespace>
  10. Perform Quick Tests:

    Utilize the MQTT CLI to conduct quick tests to verify changes

...

...