We are actively expanding the configurations available in our new Platform Operator. In the interim, if you have specific requirements to incorporate additional configurations not covered by the platform's default settings, this guide is designed to assist you.
This step-by-step guide provides instructions on how to override HiveMQ's config.xml
when the required configurations are not available in the platform's values.yaml
. This is particularly useful when you need to customize specific HiveMQ configurations not exposed to the platform's default settings.
Examples: https://docs.hivemq.com/hivemq/latest/user-guide/configuration.html#default or https://docs.hivemq.com/hivemq/latest/user-guide/configuration.html#mqtt-config or internal options etc.
Prerequisites:
Helm version v3+
Running Kubernetes cluster version 1.18.0 or higher
kubectl latest version
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
In the HiveMQ Platform Helm chart, it is possible to override the default HiveMQ config.xml from a config map.
Prepare the config map manifest,
hivemq-configuration-override.yml
. Note that the config map contains two keys:config.xml
andtracing.xml
.# Source: hivemq-platform/templates/hivemq-configuration.yml 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"> <listeners> <tcp-listener> <port>1883</port> <bind-address>0.0.0.0</bind-address> </tcp-listener> <tls-websocket-listener> <port>8000</port> <bind-address>0.0.0.0</bind-address> <path>/mqtt</path> <tls> <keystore> <path>/path/to/broker-keystore.jks</path> <password>${ENV:BROKER_KEYSTORE_PASS}</password> <private-key-password>${ENV:BROKER_KEY_PASSPHRASE}</private-key-password> </keystore> <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> <outbound-context-propagation> <enabled>false</enabled> </outbound-context-propagation> </context-propagation> <sampling> <publish-sampling> <enabled>true</enabled> </publish-sampling> </sampling> </tracing>
Create the config map.
kubectl apply -f hivemq-configuration-override.yml --namespace hivemq
Update the HiveMQ Platform values.yaml, disable to create the config map (
create: false
), and specify the new name of the config map (name: "hivemq-configuration-broker-override"
).config: create: false name: "hivemq-configuration-broker-override" overrideHiveMQConfig: "" overrideStatefulSet: "" overrideInitContainers: ""
Update the HiveMQ Platform.
helm upgrade broker --install hivemq/hivemq-platform --values values.yaml
Specify the updated in the step 3 values.yaml in the
--values values.yaml
Check the broker pods status and ensure that all pods are running and all containers are ready.
kubectl get pods --namespace hivemq -o wide
Review the content of the
config.xml
file on the broker pod and make sure that it is overridden:kubectl exec broker-0 -c hivemq -- cat conf-k8s/config.xml
Review the
hivemq.log
to confirm thatconfig.xml
is loaded successfully.kubectl logs <pod name> -n <namespace>
Perform Quick Tests:
Utilize the MQTT CLI to conduct quick tests to verify changes