Set the HiveMQ License File from a Kubernetes Secret
HiveMQ requires a valid license file placed in the /opt/hivemq/license directory within the HiveMQ container to operate properly. You can specify this license file using HiveMQ Operator in three different ways: as a raw value in the values.yaml file, as a configMap in the values.yaml file, or as a Secret in the values.yaml file. This article will guide you through the process of using a Kubernetes Secret.
Instructions
If you don't have the
values.yamlfile for the HiveMQ Operator yet, you can retrieve it from the HiveMQ Helm repository and save it to a file namedvalues.yamlusing the following command:helm show values 'hivemq/hivemq-operator' > values.yamlEdit the
values.yamlfile to configure the mapping of the HiveMQ licenseSecretto mount it into the HiveMQ container directory/opt/hivemq/license. Find thehivemqsection in thevalues.yamlfile and add the following lines:hivemq: ... secrets: # Secrets 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 ...Create a Kubernetes
Secretwith the namehivemq-licenseusing thekubectlcommand. Make sure to place the license file, in this case,hivemq-2023.lic, in the same namespace where the HiveMQ Operator is running (replace'hivemq-namespace'with your actual namespace):kubectl create secret generic 'hivemq-license' \ --from-file 'hivemq-license.lic' \ --namespace 'hivemq-namespace'Now, you can install HiveMQ with the specified license. Use the following
helm upgradecommand, providing a release name (e.g.,'hivemq-release'), the Helm chart ('hivemq/hivemq-operator'), the target namespace ('hivemq'), and thevalues.yamlfile you edited earlier:helm upgrade 'hivemq-release' \ --install 'hivemq/hivemq-operator' \ --namespace 'hivemq' \ --values 'values.yaml'HiveMQ will be installed with the license file from the Kubernetes
Secret, ensuring that it operates with the appropriate licensing.That's it! You've successfully configured HiveMQ to use a license file from a Kubernetes
Secretusing HiveMQ Operator.