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
Ensure Proper Configurations:
To run HiveMQ without encountering errors, verify that yourconfig.xml
file includes all the necessary configurations.Updating Existing Deployment:
If you have an active HiveMQ deployment and wish to make adjustments, use the following command to retrieve the currently deployed
config.xml
: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.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 ofconfig.xml
from the generated template and apply the necessary modifications:helm template my-hivemq-platform hivemq/hivemq-platform -s 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:
<?xml version="1.0"?> <hivemq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd"> <mqtt> <queued-messages> <max-queue-size>500</max-queue-size> <strategy>discard</strategy> </queued-messages> </mqtt> <listeners> <tcp-listener> <port>1883</port> <bind-address>0.0.0.0</bind-address> </tcp-listener> <websocket-listener> <port>8001</port> <bind-address>0.0.0.0</bind-address> </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> <anonymous-usage-statistics> <enabled>false</enabled> </anonymous-usage-statistics> </hivemq>
You have two options to override HiveMQ's configuration.
Option 1: Using overrideHiveMQConfig in Helm:
helm upgrade --install -f hivemq_values.yaml <installation name> hivemq/hivemq-platform --set-file config.overrideHiveMQConfig=config.xml -n <namespace>
Option 2: Using ConfigMap: Create a ConfigMap using the
config.xml
file:kubectl create configmap hivemq-configuration --from-file config.xml -n <namespace>
Edit
hivemq_values.yaml
to add the ConfigMap name and setcreate
to false:... config: create: false name: hivemq-configuration
Check Pod Status:
Verify that all hivemq pods are running.
kubectl get pods -n <namespace>
Verify log:
Check the
hivemq.log
to confirm that config.xml is loaded successfully.kubectl logs <pod name> -n <namespace>
Perform Quick Tests:
Utilize the MQTT CLI to conduct quick tests to verify changes
Please make sure listener and health-api configs (port number, settings etc) are matched with the platform’s values.yaml.