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

Version 1 Current »

This article explains how to upgrade HiveMQ and Operator from older versions to newer ones without downtime.

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

      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

      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

      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+.

        kubectl apply -f https://raw.githubusercontent.com/hivemq/helm-charts/prerelease-4.6.4/charts/hivemq-operator/crds/hivemq-cluster.yaml
      2. k8s version < 1.16

        kubectl apply -f https://raw.githubusercontent.com/hivemq/helm-charts/master/manifests/legacy/v1beta1-hivemq-cluster.yaml
  3. 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

      kubectl get deployments
    2. Scale down the operator pod.

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

      kubectl get pods
  4. Edit hivemq operator values.yaml

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

      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

      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

      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

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

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

  • No labels