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 9 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:
          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
      

  5. Create the configMap ese-db-init (it will contain the ese-db-init.sql script, that should create tables in the database and insert necessary data for the test)

    kubectl create configmap ese-db-init --from-file ese-db-init.sql
  6. helm install postgres -f postgres_values.yaml bitnami/postgresql
  7. kubectl get pods (check the status of the pod it should be running)

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

  8. connect Postgres pod using the following command to verify the connectio

    1. psql --host 127.0.0.1 -U postgres -d postgres -p 5432
    2. execute \l to list down the databases, \c <db name> to connect database, and \dt for listing down the tables;

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. 

    1. Full values of operator 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 cluster using the following command

    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 Postgres pod and create required use, roles and permissions data

  9. using mqtt CLI perform quick tests

  • No labels