AKS Gen2 VMs Preview

Azure Kubernetes Service (AKS0 was been there for a long time. AKS is the managed Kubernetes offering from Azure to host containerized applications. You can learn more about AKS from here.

Now Azure supports running Generation 2 VMs. Therefore we can take advantage of using more secure and improved performance VMs for AKS clusters.

AKS team has enabled the preview of AKS support for Gen 2 VMs. This feature is still on preview and not recommended for production usage.

Now lets see how we can use generation 2 VMs for AKS.

First we need make sure the aks-preview CLI option is installed. Then enable the feature Gen2VMPreview through Azure CLI.

az feature register --name Gen2VMPreview --namespace Microsoft.ContainerService

Next will create a new resource group

Create AKS cluster using Gen2 VMs.

az aks create --name aksgen2vmcluster --resource-group aksgen2vms -s Standard_D2s_v3 --aks-custom-headers usegen2vm=true

To create cluster it will take 10-15 min after cluster creation we can verify the VMs are used with Gen 2 as follows.

 az aks list --resource-group aksgen2vms

agentPoolProfiles": [
        "availabilityZones": null,
        "count": 3,
        "enableAutoScaling": null,
        "enableNodePublicIp": false,
        "maxCount": null,
        "maxPods": 110,
        "minCount": null,
        "mode": "System",
        "name": "nodepool1",
        "nodeImageVersion": "AKSUbuntu-1804gen2-2020.11.11",
        "nodeLabels": {},
        "nodeTaints": null,
        "orchestratorVersion": "1.18.10",
        "osDiskSizeGb": 128,
        "osDiskType": "Managed",
        "osType": "Linux",
        "powerState": {
          "code": "Running"

As you see above the the cluster use the nodeImageVersion as the gen2 VM image. From above output we can verify the cluster VMs are using Gen2 Azure VMs.