Upgrading applications using Helm
By: Date: 05/09/2021 Categories: azure Tags:
Custom Themes

I will explain how to perform upgrades using Helm operators

  1. Run the following command:

    helm install wp bitnami/wordpress You will force an update of the image of the MariaDB container. Let’s first check the version of the current image: kubectl describe statefulset wp-mariadb | grep Image

Getting the current image of the StatefulSet

Let’s look at the tags from https://hub.docker.com/r/bitnami/mariadb/tags and select another tag. For example, you could select the 10.5.8-debian-10-r44 tag to update your StatefulSet.

However, in order to update the MariaDB container image, you need to get the root password for the server and the password for the database. This is because the WordPress application is configured to use these passwords to connect to the database. By default, the update using Helm on the WordPress deployment would generate new passwords. In this case, you’ll be providing the existing passwords, to ensure the application remains functional. The passwords are stored in a Kubernetes Secret object.

You can get the MariaDB passwords in the following way: kubectl get secret wp-mariadb -o yaml

In order to get the decoded password, use the following command: echo "<password>" | base64 -d This will show us the decoded root password and the decoded database password

You also need the WordPress password. You can get that by getting the wp-wordpress secret and using the same decoding process: kubectl get secret wp-wordpress -o yaml

echo "<WordPress password>" | base64 -d

  1. You can update the image tag with Helm and then watch the pods change using the following command:

    helm upgrade wp bitnami/wordpress \ --set mariadb.image.tag=10.5.8-debian-10-r44\ --set mariadb.auth.password="<decoded password>" \ --set mariadb.auth.rootPassword="<decoded password>" \ --set wordpressPassword="<decoded password>" \ && kubectl get pods -w

This will update the image of MariaDB and make a new pod start, where you can see the previous version of the database pod being terminated, and a new one start:

 

Running describe on the new pod and grepping for Image will show us the new image version: kubectl describe pod wp-mariadb-0 | grep Image

More details refer Azure AKS