How to set secrets and use with environment variables while using Hivemq operator.

This article provides a comprehensive guide on setting up secrets with the combination of environmental variables when utilizing the HiveMQ operator. It also demonstrates how to use these secrets in the Enterprise Security Extension (ESE) for managing usernames and passwords.

Additionally, it highlights the option of using secrets exclusively for sensitive data such as Hivemq licenses or any other confidential information, based on your specific use case.

 Instructions

  1. Create a secret file name as db-secret.yaml (note username and password values are converted to base64). For example echo -n 'admin' | base64. . ====> “YWRtaW4=”

    apiVersion: v1 kind: Secret metadata: name: ese-secret type: Opaque data: dbusername: YWRtaW4= dbpassword: MWYyZDFlMmU2N2Rm
  2. Create a secret using the following command

    kubectl apply -f db-secret.yaml
  3. You can verify if the secret is created using the following command

    kubectl get secret
  4. Use created secret in Hivemq operator’s values.yaml. Please refer following example.

  5. To ensure consistency in your configuration, please utilize the same environment variables in your Security extension (ESE) configuration. Afterwards, create a configMap using the same file. Furthermore, make sure to use the identical configMap name in the values.yaml file for HiveMQ.

  6. Deploy Hivemq using values.yaml and that’s it.

Related articles