Guide for users looking to integrate and configure the Health API within the legacy HiveMQ Kubernetes Operator with cluster-stateful-set controller template.
\uD83D\uDCD8 Instructions
Get a local copy of the hivemq-operator Helm chart. This will create a directory “./hivemq-operator" in your working directory:
helm pull hivemq/hivemq-operator --untar
Go to the ./hivemq-operator/operator-tmpls and make a copy of the cluster-stateful-set.yaml in the same directory:
cd ./hivemq-operator/operator-tmpls cp cluster-stateful-set.yaml my-cluster-stateful-set.yaml
Update the configuration of the liveness and readiness probe from this:
readinessProbe: exec: command: - /opt/hivemq/bin/readiness_probe.sh initialDelaySeconds: 3 periodSeconds: 5 livenessProbe: tcpSocket: port: {{ util:getPort(spec, "mqtt").port }} initialDelaySeconds: 15 periodSeconds: 30 failureThreshold: 240
to this:
readinessProbe: httpGet: path: /api/v1/health/readiness port: 8889 scheme: HTTP initialDelaySeconds: 20 periodSeconds: 5 livenessProbe: httpGet: path: /api/v1/health/liveness port: 8889 scheme: HTTP initialDelaySeconds: 20 periodSeconds: 30 failureThreshold: 240
Copy the values.yaml file to make updates in it:
cd ./hivemq-operator cp values.yaml ../my-values.yaml cd ..
Update the hivemq.cofingOverride in the my-values.yaml. Add the block that enables the Health API:
hivemq: configOverride: | <hivemq> ... ... <health-api> <enabled>true</enabled> <listeners> <http> <port>8889</port> <name>health-api-listener</name> <bind-address>0.0.0.0</bind-address> </http> </listeners> </health-api> </hivemq>
Deploy from the local directory and supply the updated controller template file and updated values.yaml file:
cd .. helm upgrade hivemq --install ./hivemq-operator --namespace=hivemq \ --values my-values.yaml \ --set hivemq.controllerTemplate=my-cluster-stateful-set.yaml \ --set global.rbac.pspEnabled=false
In case the installation process cannot complete, cannot spawn a hivemq pod, check the journalctl on the affected node for errors. To do that, find out which node the pod fails on, ssh to the Kubernetes node, run journalctl -f | grep hivemq
and see which error(s) are there.