...
Kubernetes
Hivemq license
Install Postgress
Code Block language bash kubectl ns create <namespace name>
helm repo add bitnamiCode Block language bash kubectl ns <namespace name created by you in step 1>
Code Block language bash helm repo add bitnami https://charts.bitnami.com/bitnami
create
postgres_values.yaml
to deploy postgresPostgresCode Block language yaml global: storageClass: "rook-ceph-block" postgresql: postgresqlDatabase: "esedb" postgresqlUsername: "postgres" postgresqlPassword: "password" image: registry: docker.io repository: bitnami/postgresql tag: 11.13.0-debian-10-r40 debug: true postgresqlConfiguration: 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
Code Block language bash 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 connectionthe connectio
Code Block psql --host 127.0.0.1 -U postgres -d postgres -p 5432
execute
\l
to list down the databases
...
Create configmap for hivemq license
Code Block language bash 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 Postgres installation)
Code Block language bash 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 refer here for full config values of the operator 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
Code Block language 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
a.Code Block helm upgrade --install -f hivemq_values.yaml <release name> hivemq/hivemq-operator
Check the pods status
Kubectl getCode Block language bash kubectl get pods
check the logs of hivemq pods if deployment is complete without any error
now connect to posgres Postgres pod and create required use, roles and permissions data
using mqtt CLI perform quick tests
...