Upgrading the node image of an Azure Kubernetes Service cluster

Last year I have written a shell script to update the VMSS base image of an Azure Kubernetes Service cluster.

-> https://www.danielstechblog.io/updating-the-base-image-of-a-vmss-based-aks-cluster/
-> https://www.danielstechblog.io/aks-vmss-base-image-update-script-multiple-node-pool-support/

As I am using the VMSS API and not the AKS API it was not an officially supported way to update the VMSS base image. But on the other hand, it had no impact on the AKS cluster itself.

Finally, Microsoft announced the preview of the node image upgrade of an AKS cluster and provides an officially supported way against the AKS API.

-> https://azure.microsoft.com/en-us/updates/azure-kubernetes-service-upgrade-improvements-are-now-in-preview/

The first thing you need to do is onboarding you Azure subscription into the preview and install the AKS Azure CLI preview extension.

> az feature register --namespace Microsoft.ContainerService --name NodeImageUpgradePreview
> az provider register --namespace Microsoft.ContainerService
> az extension add --name aks-preview

Afterwards you can upgrade the node image for the whole Azure Kubernetes Service cluster or only for specific node pools.

The node image upgrade for the whole cluster is initiated with the following command.

> az aks upgrade --resource-group azst-aks2 --name azst-aks2 --node-image-only

When only a specific node pool should be upgraded the command is as follows.

> az aks nodepool upgrade --resource-group azst-aks2 --cluster-name azst-aks2 --name nodepool1 --node-image-only

Looking for more information? Have a look at the Azure documentation.

-> https://docs.microsoft.com/en-us/azure/aks/node-image-upgrade