Prerequisites:
Kubernetes
Hivemq license
Install Postgress
kubectl ns create <namespace name>
kubectl ns <namespace name created by you in step 1>
helm repo add bitnami https://charts.bitnami.com/bitnami
create
postgres_values.yaml
to deploy Postgresglobal: storageClass: "rook-ceph-block" postgresql: auth: password: password postgresPassword: password username: admin image: registry: docker.io repository: bitnami/postgresql tag: 11.13.0-debian-10-r40 debug: true primary: initdb: scriptsConfigMap: ese-db-init postgresqlConfiguration: hugePages: "off" hugePages: off listenAddresses: "*" resources: limits: hugepages-2Mi: 500Mi requests: memory: 256Mi cpu: 250m extraVolumeMounts: - mountPath: /hugepages-2Mi name: hugepage-2mi extraVolumes: - name: hugepage-2mi emptyDir: medium: HugePages-2M networkPolicy: enabled: true
helm install postgres -f postgres_values.yaml bitnami/postgresql
kubectl get pods (check the status of the pod it should be running)
if the error is observed then check the pod logs
connect Postgres pod using the following command to verify the connectio
psql --host 127.0.0.1 -U postgres -d postgres -p 5432
execute
\l
to list down the databases,\c <db name>
to connect database, and\dt
for listing down the tables;
Setup hivemq with ESE:
Create configmap for hivemq license
kubectl create configmap hivemq-license --from-file=hivemq-2021.lic
Create configmap for ESE configuration(make sure you use database name, username and password you have configured during Postgres installation)
kubectl create configmap enterprise-security-extension-config --from-file=enterprise-security-extension.xml
Create
hivemq_values.yaml
for deploying hivemq using Kubernetes operatorMake sure to add configuration to have ESE extension is preinstalled.
Full values of operator can be found herehttps://github.com/hivemq/helm-charts/blob/master/charts/hivemq-operator/values.yaml
example hivemq_values.yaml
hivemq: cpu: 8 extensions: - enabled: true extensionUri: preinstalled initialization: | # A little hack because k8s configMaps can't handle sub-directories [[ -e /conf-override/extensions/hivemq-enterprise-security-extension/enterprise-security-extension.xml ]] && rm -f $(pwd)/conf/enterprise-security-extension.xml && rm -f $(pwd)/enterprise-security-extension.xml && cp -s /conf-override/extensions/hivemq-enterprise-security-extension/enterprise-security-extension.xml $(pwd)/conf/enterprise-security-extension.xml [[ ! -f drivers/postgres-jdbc.jar ]] && curl -L https://jdbc.postgresql.org/download/postgresql-42.2.14.jar --output drivers/jdbc/postgres.jar name: hivemq-enterprise-security-extension configMap: enterprise-security-extension-config image: hivemq/hivemq4:k8s-4.7.1 imagePullPolicy: Always memory: 8Gi nodeCount: "2" ports: - expose: true name: mqtt patch: - '[{"op":"add","path":"/spec/type","value":"LoadBalancer"}]' port: 1883 - expose: true name: cc patch: - '[{"op":"add","path":"/spec/sessionAffinity","value":"ClientIP"}]' port: 8080 configMaps: - name: hivemq-license path: /opt/hivemq/license operator: admissionWebhooks: enabled: false
Deploy hivemq cluster using the following command
helm upgrade --install -f hivemq_values.yaml <release name> hivemq/hivemq-operator
Check the pods status
kubectl get pods
check the logs of hivemq pods if deployment is complete without any error
now connect to Postgres pod and create required use, roles and permissions data
using mqtt CLI perform quick tests