Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Prerequisites:

  • Kubernetes

  • Hivemq license

Install Postgress

  1. kubectl ns create <namespace name>

  2. kubectl ns <namespace name created by you in step 1>

  3. helm repo add bitnami https://charts.bitnami.com/bitnami

  4. create postgres_values.yaml to deploy postgres

    1. 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
  5. helm install postgres -f postgres_values.yaml bitnami/postgresql

  6. kubectl get pods (check status of the pod it should be running)

    1. if the error is observed then check the pod logs

  7. connect Postgres pod using the following command to verify connection

    1. psql --host 127.0.0.1 -U postgres -d postgres -p 5432

    2. execute \l to list down the databases

Setup hivemq with ESE:

  1. Create configmap for hivemq license

    1. kubectl create configmap hivemq-license --from-file=hivemq-2021.lic

  2. Create configmap for ESE configuration(make sure you use database name, username and password you have configured during postgres installation)

    1. kubectl create configmap enterprise-security-extension-config --from-file=enterprise-security-extension.xml

  3. Create hivemq_values.yaml for deploying hivemq using Kubernetes operator

  4. Make sure to add configuration to have ESE extension is preinstalled refer here for full config values of the operator 

    1. Full values can be found herehttps://github.com/hivemq/helm-charts/blob/master/charts/hivemq-operator/values.yaml

    2. example hivemq_values.yaml

      1. 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
  5. Deploy hivemq using the following command

    a. helm upgrade --install -f hivemq_values.yaml <release name> hivemq/hivemq-operator

  6. Check the pods status

    1. Kubectl get pods

  7. check the logs of hivemq pods if deployment is complete without any error

  8. now connect to posgres pod and create required use, roles and permissions data

  9. using mqtt CLI perform quick tests

  • No labels