Редагувати

Поділитися через


Use generation 2 virtual machines in Azure Kubernetes Service (AKS)

Azure supports Generation 2 (Gen 2) virtual machines (VMs). Generation 2 VMs support key features not supported in Generation 1 (Gen 1) VMs, including increased memory, Intel Software Guard Extensions (Intel SGX), and virtualized persistent memory (vPMEM).

Generation 2 VMs use the new UEFI-based boot architecture rather than the BIOS-based architecture used by Generation 1 VMs. Only specific SKUs and sizes support Generation 2 VMs. Check the list of supported sizes to see if your SKU supports or requires Generation 2.

Additionally, not all VM images support Generation 2 VMs. On AKS, Generation 2 VMs use the AKS Ubuntu 22.04 or 18.04 image or the AKS Windows Server 2022 image. These images support all Generation 2 SKUs and sizes.

Default behavior for supported vm sizes

There are three scenarios when creating a node pool with a supported VM size:

  1. If the VM size supports only Generation 1, the default behavior for both Linux and Windows node pools is to use the Generation 1 node image.
  2. If the VM size supports only Generation 2, the default behavior for both Linux and Windows node pools is to use the Generation 2 node image.
  3. If the VM size supports both Generation 1 and Generation 2, the default behavior for Linux and Windows differs. Linux uses the Generation 2 node image, and Windows uses Generation 1 image. To use the Generation 2 node image, see Create a Windows node pool with a Generation 2 VM.

Check available Generation 2 VM sizes

Check available Generation 2 VM sizes using the az vm list-skus command.

az vm list-skus --location <location> --size <vm-size> --output table

Create a node pool with a Generation 2 VM

By default, Linux uses the Generation 2 node image unless the VM size doesn't support Generation 2.

Create a Linux node pool with a Generation 2 VM using the default node pool creation process.

Update an existing node pool to use a Generation 2 VM

If you're using a VM size that only supports Generation 1, you can update your node pool to a vm size that supports Generation 2 using the az aks nodepool update command. This update changes your node image from Generation 1 to Generation 2.

az aks nodepool update --resource-group <resource-group-name> --cluster-name <cluster-name> --name <node-pool-name> --vm-size <supported-generation-2-vm-size> --os-type Linux

Check if you're using a Generation 2 node image

Verify a successful node pool creation using the az aks nodepool show command and check that the nodeImageVersion contains gen2 in the output.

az aks nodepool show --resource-group <resource-group-name> --cluster-name <cluster-name> --name <node-pool-name>

Next steps

To learn more about Generation 2 VMs, see Support for Generation 2 VMs on Azure.