Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Kubernetes

  • Hivemq license

Install Postgress

  1. Code Block
    languagebash
    kubectl ns create <namespace name>
  2. Code Block
    languagebash
    kubectl ns <namespace name created by you in step 1>
    helm repo add bitnami
  3. Code Block
    languagebash
    helm repo add bitnami https://charts.bitnami.com/bitnami
  4. create postgres_values.yaml to deploy postgresPostgres

    1. Code Block
      languageyaml
      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. Code Block
    languagebash
    helm install postgres -f postgres_values.yaml bitnami/postgresql
  6. kubectl get pods (check the 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 connectionthe connectio

    1. Code Block
      psql --host 127.0.0.1 -U postgres -d postgres -p 5432
    2. execute \l to list down the databases

...

  1. Create configmap for hivemq license

    1. Code Block
      languagebash
      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 Postgres installation)

    1. Code Block
      languagebash
      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 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. Code Block
        languageyaml
        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

    Code Block
    a.
    helm upgrade --install -f hivemq_values.yaml <release name> hivemq/hivemq-operator
  6. Check the pods status

    Kubectl get

    1. Code Block
      languagebash
      kubectl get pods
  7. check the logs of hivemq pods if deployment is complete without any error

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

  9. using mqtt CLI perform quick tests

...