Table of Contents |
---|
Prerequisite
Access to infrastructure with Kubectl
Kubectl, Helm and MQTT CLI Prerequisite - Software Packages
We recommend creating separate namespaces for each product e.g. HiveMQ, Kafka, Swarm etc to easily manage the installations.
Create a HiveMQ namespace
Create a new namespace
Code Block kubectl create namespace hivemq
Set the namespace as the default
Code Block kubectl config set-context --current --namespace=hivemq
You can confirm your namespace using the following
Code Block kubectl config view --minify -o jsonpath='{..namespace}'
Add Helm repository and download values.yaml file
To use the HiveMQ Kubernetes Operator to deploy and manage your HiveMQ cluster on the Kubernetes nodes, you need to add the HiveMQ Helm repository to your Helm installation:
Code Block |
---|
helm repo add hivemq https://hivemq.github.io/helm-charts |
Code Block |
---|
helm repo update |
Download the
values.yaml
file and open it in a code editor of your choice( we use VSCode). This file will be modified for configuration changes in the future
Code Block |
---|
helm show values hivemq/hivemq-operator > values.yaml |
Add a License
Please skip this step if you are using a HiveMQ trial license. If you do not have a valid HiveMQ license, the HiveMQ cluster uses a trial licence that allows up to 25 concurrent client connections and is limited to testing and evaluation purposes only. To obtain a HiveMQ licence that is suitable for production use, or request an evaluation licence that allows more connections, contact our customer service team.
If you have a valid HiveMQ license, create a hivemq-license
Kubernetes ConfigMap from your licence file to make the licence information accessible for the HiveMQ deployment you execute in the next step.
Move the license to
Please replace hivemq-license.lic with your license name.
Code Block |
---|
kubectl create configmap hivemq-license --from-file=hivemq-license.lic |
Open your values.yaml file in a text editor
Search the hivemq-license configmap
Code Block |
---|
configMaps: []
# ConfigMaps to mount to the HiveMQ pods. These can be mounted to existing directories without shadowing the folder contents as well.
#- name: hivemq-license
# path: /opt/hivemq/license |
Uncomment the name and path variables, please make sure that name and path are properly aligned under configMaps
Code Block |
---|
configMaps:
# ConfigMaps to mount to the HiveMQ pods. These can be mounted to existing directories without shadowing the folder contents as well.
- name: hivemq-license
path: /opt/hivemq/license |
Save the file
...
The values.yaml contains resource definitions such as cpu , memory , disk size and others. In our case we use the following
nodecount: 3
cpu: "4"
memory: "4Gi"
ephemeralStorage: "15Gi"
Apply the changes to the cluster
Pod creation takes time(~3 min for us), please check the pods and services for latest status.
Code Block |
---|
helm upgrade hivemq --install hivemq/hivemq-operator --values values.yaml |
Verify
...
if the HiveMQ Cluster is running successfully
Please make sure that pods are running successfully after the change, it may take some time for the pods to be ready
...
Check the Hivemq deployment log by running the following and checking for INFO - Started HiveMQ in XYZ ms
Code Block |
---|
kubectl logs deployments/hivemq | grep license |
...
If the log contains something similar to INFO - Using valid XYZ license
, the license is successfully applied.
If the license is not correctly applied, you will see the following in logs
...
'Started HiveMQ in' |