Versions Compared

Key

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

...

Info

Mandatory Custom Resource Definition Update

Since HiveMQ 4.7, the HiveMQ Kubernetes Operator supports the stable v1 api version of CustomResourceDefinition. Use of the v1 CustomResourceDefinition requires a mandatory update of your CRD. The update does not require any downtime.

Prerequisites:

  1. k8s version 1.16+ and < 1.25 is installed

  2. Helm version 3 is installed

  3. Hivemq k8s operator chart version < 0.9.0. You can verify this using helm list command

\uD83D\uDCD8 Instructions

  1. Since Hivemq Operator CRD was updated with HiveMQ 4.7.0 release. The first step is to upgrade HiveMQ to the max version before the 4.7.0 version i.e. 4.6.12 version.

    1. Edit your HiveMQ values.yaml to update the HiveMQ image
      Refer to the following example:

      Code Block
      hivemq:
        image: hivemq/hivemq4:k8s-4.6.12  
    2. Refer Upgrade guide and make changes in your value.yaml if any is recommended. For example, if you are upgrading from 4.5.x to 4.6.12 then check HiveMQ 4.5 to 4.6 guide etc. This will make sure you do not miss any updates and avoid unnecessary surprises.

    3. Once all changes are included in values.yaml then do a rolling upgrade

      Code Block
      helm upgrade --install -f <values.yaml> <release name> hivemq/hivemq-operator
    4. Once the rolling upgrade is completed, all hivemq pods will be running HiveMq 4.6.12 version. You can verify hivemq.log for confirmation.

    5. Please verify if the broker is working as expected after this upgrade and then move to the next step.

  2. Until now, you are using chart versions older than 0.9.0, With this step, we will be updating CRD.
    You must update your CustomResourceDefinition. And this can be done without any downtime. Refer here for CHANGELOG.

    1. Update helm repository

      Code Block
      helm repo update
    2. Simply apply the new CRD using the following command (considering)

      1. k8s version is 1.16+. The Helm Chart now uses v1 CustomResourceDefinition by default. This is only supported in Kubernetes 1.16+.

        Code Block
        kubectl apply -f https://raw.githubusercontent.com/hivemq/helm-charts/prerelease-4.6.4/charts/hivemq-operator/crds

...

k8s version < 1.16

...

      1. /

...

      1. hivemq-cluster.yaml
  1. Scale the operator to 0 so it doesn’t immediately reconcile. This will only remove the operator pod, but leave the HiveMQ nodes as remaining.

    1. With help of the following command, you can get the operator depoyment name

      Code Block
      kubectl get deployments
    2. Scale down the operator pod.

      Code Block
      kubectl scale --replicas=0 deployment/<operator name>
    3. Now, the pod’s list has only hivemq pods.

      Code Block
      kubectl get pods
  2. Edit hivemq operator values.yaml

    1. update the hivemq version for example to 4.7.12. Refer to the following example:

      Code Block
      hivemq:
        image: hivemq/hivemq4:k8s-4.7.12  
    2. Refer Upgrade guide and make sure to do changes in your value.yaml if any is recommended. This will make sure you do not miss any updates and avoid unnecessary surprises.

    3. Once all changes are included in values.yaml then do a rolling upgrade

      Code Block
      helm upgrade --install -f <values.yaml> <release name> hivemq/hivemq-operator
    4. After the rolling upgrade, the hivemq operator pod will be added with the new chart version. You can verify this with the following command, and check the CHART. It should be hivemq-operator-0.11.6

      Code Block
      helm list
    5. Once the rolling upgrade is completed, all hivemq pods will be running HiveMq 4.7.12 version. You can verify hivemq.log for confirmation.

    6. Please verify if the broker is working as expected after this upgrade

  3. Repeat step 4 until you reach to latest hivemq version.

Note

We highly recommend to perform testing on stagging or testing environment before moving to production.