Use Heartbeat extension with HiveMQ Kubernetes Operator
Instructions
Get a local copy of the Helm chart.
This will download the chart of the version $CHART_VERSION and untar it to the subdirectoryhivemq-operator:helm pull hivemq/hivemq-operator --version $CHART_VERSION --untarHint: To download the latest chart version, omit the option
--version $CHART_VERSION. To learn more about chart versions refer to the article https://hivemq.atlassian.net/wiki/spaces/KB/pages/2406449153.Update dependencies in the chart’s directory.
This command verifies that the required charts, as expressed in 'Chart.yaml', are present in 'charts/' and are at an acceptable version. It will pull down the latest charts that satisfy the dependencies, and clean up old dependencies.helm dependencies update hivemq-operatorHang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "hivemq" chart repository ...Successfully got an update from the "prometheus-community" chart repository Update Complete. ⎈Happy Helming!⎈ Saving 1 charts Downloading kube-prometheus-stack from repo https://prometheus-community.github.io/helm-charts Deleting outdated chartsEdit operator templates, and update the livenessProbe’s declaration.
Edit the operator templates:
hivemq-operator/operator-tmpls/cluster-daemon-set.yaml
hivemq-operator/operator-tmpls/cluster-deployment.yaml
hivemq-operator/operator-tmpls/cluster-stateful-set.yaml
Find the existing declaration of the livenessProbe:
livenessProbe: tcpSocket: port: {{ util:getPort(spec, "mqtt").port }} initialDelaySeconds: 15 periodSeconds: 30 failureThreshold: 240Replace with the new declaration of the livenessProbe:
livenessProbe: httpGet: path: /heartbeat port: {{ util:getPort(spec, "heartbeat").port }} initialDelaySeconds: 30 periodSeconds: 15 failureThreshold: 240
Get the values.yaml file for the hivemq-operator of the version $CHART_VERSION:
helm show values hivemq/hivemq-operator --version $CHART_VERSION > my-values.yamlHint: To download from the latest chart version, omit the option --version $CHART_VERSION. To learn more about chart versions refer to the article https://hivemq.atlassian.net/wiki/spaces/KB/pages/2406449153.
Edit the
my-values.yamlfile:Add the heartbeat extension to the end of the
hivemq.extensionsarray:hivemq: ... extensions: ... ... - name: hivemq-heartbeat-extension extensionUri: https://github.com/hivemq/hivemq-heartbeat-extension/releases/download/1.0.4/hivemq-heartbeat-extension-1.0.4.zip enabled: trueAdd the heartbeat port to the end of the
hivemq.portsarray:hivemq: ... ports: ... ... - name: "heartbeat" port: 9090 expose: true
Using Helm, install hivemq-operator from the local directory
hivemq-operatorwhich is containing updated operator templates, and use the updatedmy-values.yaml:helm upgrade my-hivemq \ --install hivemq-operator \ --values my-values.yamlWhen the hivemq-operator and hivemq pods are ready, monitor the event.log:
kubectl exec pod/my-hivemq-abcdefgh -- tail -f log/event.log