Update WordPress on AKS Kubernetes Cluster

In this blog post we will learn how to update a WordPress deployment on Azure Kubernetes Service (AKS) with helm.

WordPress

In the previous posts on the topic, we have deployed our DeployContainers.COM blog on AKS using helm charts and the Bitnami WordPress image for Kubernetes.

Today we will learn how to update the Bitnami WordPres image which receive updates every few weeks. The process is not as simple as many people would like it to be but once you do it once or twise it will be easy enough to finish the updates under 10 minutes.

Steps

The first step is to visit the Bitnamin WordPress package page in the following and check the version number:

https://artifacthub.io/packages/helm/bitnami/wordpress

In the example below I am using the following names:

  • WordPress deployment is called deploycontainers.
  • Helm chart name is called deploycontainers-wordpress
  • My namespace is called ingress-basic

If you are not on the latest version start with the step below which will update the Helm chart repo which will allow Helm to sync and check if there are now versions.

helm repo update

Important: Change the details in the commands below to fit your environment.

Next, I will run the command below which will use deployment name (kubectl get secret –namespace ingress-basic )

export WORDPRESS_PASSWORD=$(kubectl get secret --namespace ingress-basic deploycontainers-wordpress -o jsonpath="{.data.wordpress-password}" | base64 --decode)

Use secret name (check with kubectl get secret –namespace ingress-basic)

export MARIADB_ROOT_PASSWORD=$(kubectl get secret --namespace ingress-basic deploycontainers-mariadb -o jsonpath="{.data.mariadb-root-password}" | base64 --decode)

Use secret name (check with kubectl get secret –namespace ingress-basic)

export MARIADB_PASSWORD=$(kubectl get secret --namespace ingress-basic deploycontainers-mariadb -o jsonpath="{.data.mariadb-password}" | base64 --decode)

In the line below we need to use the PVC MariaDB is using and in most cases, you need to use the helm chart name (deploycontianers in my case)

export MARIADB_PVC=$(kubectl get pvc --namespace ingress-basic -l app.kubernetes.io/instance=deploycontainers,app.kubernetes.io/name=mariadb,app.kubernetes.io/component=primary -o jsonpath="{.items[0].metadata.name}")

After we have saved all the details into variables we can start the update process using the two commands below.

Note: In my case, I am running the command with the .YAML file of my original deployment. This is a must.

helm upgrade deploycontainers bitnami/wordpress --namespace ingress-basic --values=wp-deploycontainers.yaml --set wordpressPassword=$WORDPRESS_PASSWORD --set replicaCount=0 --set mariadb.enabled=false --version 9.6.4 --namespace ingress-basic

Below is the last command you will need to run.

helm upgrade deploycontainers bitnami/wordpress --namespace ingress-basic --values=wp-deploycontainers.yaml --set mariadb.primary.persistence.existingClaim=$MARIADB_PVC --set mariadb.auth.rootPassword=$MARIADB_ROOT_PASSWORD --set mariadb.auth.password=$MARIADB_PASSWORD --set wordpressPassword=$WORDPRESS_PASSWORD

If you followed the above steps the update process will be successful.


Posted

in

,

by