Daniel's Tech Blog

Cloud Computing, Cloud Native & Kubernetes

AKS VMSS base image update script – multiple node pool support

At the beginning of September, I have published a blog post about how to update the base image of a VMSS-based AKS cluster.

-> https://www.danielstechblog.io/updating-the-base-image-of-a-vmss-based-aks-cluster/

On LinkedIn I had a good discussion with one of the AKS PMs about that and I want to highlight two things first.

The shell script I have written directly interacts with the VMSS API and not with the AKS API.

If you are familiar with Azure, you may already know this or assume it after reading the blog post mentioned above. But I wanted to clearly point that out.

Cause interacting with the VMSS API to update the base image, only updates the base image for a particular VMSS. New node pools, AKS multiple node pools are in preview, using the base image referenced in the AKS API. Unfortunately, you cannot change the base image via the AKS API for the whole AKS cluster today.

So, if you want to update the base image you must do it for every (new) node pool in a VMSS-based AKS cluster.

After knowing the background, we proceed to the actual topic of this blog post: Multiple node pool support.

I made some changes to the shell script. The script now supports VMSS-based AKS clusters with multiple node pools.

Furthermore, the script skips node pools in the AKS cluster that already running with the latest base image.

[2019-09-19 09:28:25] Gathering information about the Azure Kubernetes Service cluster and the latest base image...
[2019-09-19 09:28:33] Skipping VMSS aks-nodepool1-14987876-vmss. No newer base image version available...
[2019-09-19 09:28:37] Updating base image for VMSS aks-nodepool2-14987876-vmss...
{
  "id": null,
  "offer": "aks",
  "publisher": "microsoft-aks",
  "sku": "aks-ubuntu-1604-201909",
  "version": "2019.09.16"
}
[2019-09-19 09:28:49] Updating VMSS instances...
[2019-09-19 09:28:50] Draining node aks-nodepool2-14987876-vmss000000...
[2019-09-19 09:28:50] Updating VMSS instance aks-nodepool2-14987876-vmss000000...
[2019-09-19 09:32:22] Uncordon node aks-nodepool2-14987876-vmss000000...
[2019-09-19 09:32:23] Draining node aks-nodepool2-14987876-vmss000001...
[2019-09-19 09:32:23] Updating VMSS instance aks-nodepool2-14987876-vmss000001...
[2019-09-19 09:35:56] Uncordon node aks-nodepool2-14987876-vmss000001...
[2019-09-19 09:35:56] Base image update finished...
[2019-09-19 09:38:14] Gathering information about the Azure Kubernetes Service cluster and the latest base image...
[2019-09-19 09:38:20] Skipping VMSS aks-nodepool1-14987876-vmss. No newer base image version available...
[2019-09-19 09:38:25] Skipping VMSS aks-nodepool2-14987876-vmss. No newer base image version available...
[2019-09-19 09:38:25] Base image update finished...

You can find the script for AKS and AKS Engine clusters on GitHub.

AKS:

-> Script: https://github.com/neumanndaniel/kubernetes/blob/master/aks/aksBaseImageUpdate.sh
-> How-to guide: https://www.danielstechblog.io/updating-the-base-image-of-a-vmss-based-aks-cluster/

AKS Engine:

-> Script: https://github.com/neumanndaniel/kubernetes/blob/master/aks-engine/aksEngineBaseImageUpdate.sh
-> How-to guide: https://www.danielstechblog.io/updating-the-base-image-of-an-vmss-aks-engine-cluster/


Posted

in

WordPress Cookie Notice by Real Cookie Banner