You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Windows nodepools not upgraded to Gen2 during cluster node image upgrade
3
-
description: Troubleshoot why Windows Server nodepools don't get upgraded automatically from Gen1 to Gen2 when a cluster node image is upgraded in Azure Kubernetes Service.
4
-
ms.date: 11/20/2024
2
+
title: Windows Node Pools Not Upgraded to Gen2 During Cluster Node Image Upgrade
3
+
description: Troubleshoot an issue that prevents Windows Server node pools from upgrading automatically to Gen2 when a cluster node image is upgraded in Azure Kubernetes Service.
4
+
ms.date: 04/17/2025
5
5
editor: v-jsitser
6
-
ms.reviewer: chiragpa, cssakscic, v-leedennis
6
+
ms.reviewer: chiragpa, cssakscic, momajed
7
7
ms.service: azure-kubernetes-service
8
-
#Customer intent: As an Azure Kubernetes Services (AKS) user, I want to troubleshoot why Windows Server nodepools don't get upgraded automatically from Gen1 to Gen2 virtual machines (VMs) when a cluster node image is upgraded in Azure Kubernetes Service (AKS).
9
-
ms.custom: sap:Create, Upgrade, Scale and Delete operations (cluster or nodepool)
8
+
#Customer intent: As an Azure Kubernetes Services (AKS) user, I want to troubleshoot why Windows Server node pools don't get upgraded automatically from Gen1 to Gen2 virtual machines (VMs) when a cluster node image is upgraded in Azure Kubernetes Service (AKS).
9
+
ms.custom: sap:Create, Upgrade, Scale and Delete operations (cluster or node pool)
10
10
---
11
-
# Windows Server nodepools not upgraded to Gen2 during cluster node image upgrade
12
11
13
-
This article discusses how to troubleshoot a scenario in which Windows Server nodepools don't get upgraded automatically from Gen1 to Gen2 virtual machines (VMs) when a cluster node image is upgraded in Microsoft Azure Kubernetes Service (AKS).
12
+
# Windows Server node pools not upgraded to Gen2 during cluster node image upgrade
13
+
14
+
This article discusses how to troubleshoot a scenario in which Windows Server node pools don't get upgraded automatically from Gen1 to Gen2 virtual machines (VMs) when a cluster node image is upgraded in Microsoft Azure Kubernetes Service (AKS).
14
15
15
16
> [!NOTE]
16
-
> This scenario doesn't apply to Gen2 VMs on Linux nodepools.
17
+
> This scenario doesn't apply to Gen2 VMs on Linux node pools.
17
18
18
19
## Prerequisites
19
20
20
-
-[Azure CLI](/cli/azure/install-azure-cli)
21
+
-Azure CLI version 2.0.81 or later. See [Install Azure CLI](/cli/azure/install-azure-cli) for installation instructions.
21
22
22
23
## Symptoms
23
24
24
-
Existing Windows Server nodepools don't get upgraded from Gen1 to Gen2 when you [upgrade the node image](/azure/aks/node-image-upgrade) by using one of the following methods in Azure CLI:
25
+
Existing Windows Server node pools don't get upgraded from Gen1 to Gen2 when you [upgrade the node image](/azure/aks/node-image-upgrade) by using one of the following methods in Azure CLI:
25
26
26
-
- An entire cluster upgrade (by using the [az aks upgrade](/cli/azure/aks#az-aks-upgrade) command)
27
+
- An entire cluster upgrade (by using the [`az aks upgrade`](/cli/azure/aks#az-aks-upgrade) command)
27
28
28
-
- A specific nodepool upgrade (by using the [az aks nodepool upgrade](/cli/azure/aks/nodepool#az-aks-nodepool-upgrade) command)
29
+
- A specific node pool upgrade (by using the [`az aks nodepool upgrade`](/cli/azure/aks/nodepool#az-aks-nodepool-upgrade) command)
29
30
30
31
## Cause
31
32
32
-
### Cause 1: Existing nodepools aren't automatically upgraded to Gen2 VMs
33
+
### Cause 1: Existing node pools aren't automatically upgraded to Gen2 VMs
33
34
34
-
By design, a node image upgrade doesn't support updating or upgrading existing nodepools. The `az aks upgrade` and `az aks nodepool upgrade` commands upgrade only the node image (to a later node image version). Those commands don't upgrade the corresponding VM generation.
35
+
By design, a node image upgrade doesn't support updating or upgrading existing node pools. The `az aks upgrade` and `az aks nodepool upgrade` commands upgrade only the node image (to a later node image version). These commands don't upgrade the corresponding VM generation.
35
36
36
37
### Cause 2: Cluster upgrade to Kubernetes version 1.25 or a later version upgrades only the OS
37
38
38
-
When you upgrade your cluster to Kubernetes version 1.25 or a later version, only the operating system (OS) is upgraded (to Windows Server 2022). Existing nodepools aren't affected. The associated VM scale set will contain VMs that have the same Gen1 VM.
39
+
When you upgrade your cluster to Kubernetes version 1.25 or a later version, only the operating system (OS) is upgraded (to Windows Server 2022). Existing node pools aren't affected. The associated Azure Virtual Machine Scale Sets contain VMs that have the same Gen1 VM.
39
40
40
-
### Cause 3: Cluster upgraded and new nodepool created by using Windows Server 2022 without specifying a valid VM size
41
+
### Cause 3: Cluster upgraded and new node pool created by using Windows Server 2022 without specifying a valid VM size
41
42
42
-
After you upgrade the cluster to Kubernetes version 1.25 or a later version, you specify Windows Server 2022 as the OS to use on the nodepool's VMs. However, the VMs don't use a Gen2 node image reference because of one of the following reasons:
43
+
After you upgrade the cluster to Kubernetes version 1.25 or a later version, you specify Windows Server 2022 as the OS to use on the node pool's VMs. However, the VMs don't use a Gen2 node image reference for one of the following reasons:
43
44
44
45
- You don't specify a VM size, and the default VM size in the region doesn't support Gen2 VMs.
45
46
46
47
- You specify a Gen1-only VM size.
47
48
48
-
When you upgrade the default OS from Windows Server 2019 (`Windows2019`) to Windows Server 2022 (`Windows2022`), the existing nodepools aren't automatically upgraded to a different VM generation.
49
+
When you upgrade the default OS from Windows Server 2019 (`Windows2019`) to Windows Server 2022 (`Windows2022`), the existing node pools aren't automatically upgraded to a different VM generation.
49
50
50
51
## Solution
51
52
52
-
Upgrade the cluster, and then create a new Windows Server nodepool that supports [Gen2 VM sizes](/azure/virtual-machines/generation-2) on that cluster according to the following guidelines.
53
+
Upgrade the cluster, and then create a new Windows Server node pool that supports [Gen2 VM sizes](/azure/virtual-machines/generation-2) on that cluster according to the following guidelines.
53
54
54
55
| Kubernetes cluster upgrade version | Cluster creation guidelines |
55
56
|---|---|
56
-
| 1.25 or a later version | When you run the [az aks create](/cli/azure/aks#az-aks-create) command to create a cluster, set the `--node-vm-size` parameter to a [Gen2 VM size](/azure/virtual-machines/generation-2). |
57
-
| Earlier version than 1.25 | When you run the [az aks create](/cli/azure/aks#az-aks-create) command to create a cluster, set the `--os-sku` parameter value to `Windows2022`, and set the `--node-vm-size` parameter value to a [Gen2 VM size](/azure/virtual-machines/generation-2). |
57
+
| 1.25 or a later version | When you run the [`az aks create`](/cli/azure/aks#az-aks-create) command to create a cluster, set the `--node-vm-size` parameter to a [Gen2 VM size](/azure/virtual-machines/generation-2). |
58
+
| Any version earlier than 1.25 | When you run the [`az aks create`](/cli/azure/aks#az-aks-create) command to create a cluster, set the `--os-sku` parameter value to `Windows2022`, and set the `--node-vm-size` parameter value to a [Gen2 VM size](/azure/virtual-machines/generation-2). |
59
+
58
60
59
61
> [!NOTE]
60
-
> If you specify a Gen2 VM size and the operating system as Windows Server 2019, you receive an `ErrorCode_Windows2019NotSupportedWithGen2VM` error code that's accompanied by the following error message:
62
+
> If you specify a Gen2 VM size and set the operating system as Windows Server 2019, you receive an `ErrorCode_Windows2019NotSupportedWithGen2VM` error code that's accompanied by the following error message:
61
63
>
62
64
> > \<virtual-machine-size> is a Gen 2-only VM. Windows2019 does not support Gen 2 VMs. However, you can select a Gen 1 VM size or set os_sku to 2022.
63
65
>
@@ -66,5 +68,11 @@ Upgrade the cluster, and then create a new Windows Server nodepool that supports
66
68
> - Pick a Gen1 VM size to use together with Windows Server 2019.
67
69
>
68
70
> - Set the operating system SKU to **Windows Server 2022** to use together with your Gen2 VM.
71
+
>
72
+
> - Before you create a new node pool, verify that the VM size supports Gen2 VMs in your region. To do this, run `az vm list-sizes --location <region> --query "[?contains(name, 'v2')].name" --output table`.
73
+
>
74
+
> - To verify the current and available node image versions, run the following commands:
75
+
> - To check the current version: `az aks nodepool show --resource-group <resource-group> --cluster-name <cluster-name> --name <nodepool-name> --query nodeImageVersion`
76
+
> - To check the latest available version: `az aks nodepool get-upgrades --resource-group <resource-group> --cluster-name <cluster-name> --nodepool-name <nodepool-name> --query latestNodeImageVersion`
69
77
70
78
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]
Write-Host "There was an error mapping $MappedDrive.RemotePath to $MappedDrive.LocalPath"
56
+
Write-Host "There was an error mapping $($MappedDrive.RemotePath) to $($MappedDrive.LocalPath)"
57
57
}
58
58
}
59
59
$i = $i - 1
@@ -72,28 +72,45 @@ All workarounds should be executed in standard user security context. Executing
72
72
> [!NOTE]
73
73
> This workaround works only for the device that has network access at logon. If the device has not established a network connection by the time of logon, the startup script won't automatically reconnect network drives.
74
74
75
-
1. Copy the script file (MapDrives.cmd) to the following location:
9. In the **Start in (optional)** field, type the location of the script file: **%SystemDrive%\\Scripts\\**.
98
96
10. On the **Conditions** tab, select the **Start only if the following network connection is available** option, select **Any connection**, and then select **OK**.
99
-
11. Log off, and then log back on to the device to run the scheduled task.
97
+
11. Sign out, and then sign in to the device to run the scheduled task.
98
+
99
+
#### Workaround 3: Create a scheduled task for VPN connection Event ID 20225
100
+
101
+
> [!NOTE]
102
+
> Event ID 20225 indicates that a virtual private network (VPN) connection is successfully established.
103
+
104
+
1. Copy the script file **MapDrives.ps1** to the following location: **%SystemDrive%\\Scripts\\**.
105
+
2. In **Task Scheduler**, select **Action** > **Create Task**.
106
+
3. On the **General** tab in the **Create Task** dialog, type a name (such as **Map Network Drives**) and description for the task.
107
+
4. Select **Change User or Group**, select a local user or group (such as **LocalComputer\\Users**) and then select **OK**.
108
+
5. On the **Triggers** tab, select **New**, and then select **On an event** for the **Begin the task** field.
109
+
6. Select **Application** from the **Log** dropdown list, type **RasClient** in the **Source** field, and type **20225** in the **Event ID** field. Then, select **OK**.
110
+
7. On the **Actions** tab, select **New**, and then select **Start a program** for the **Action** field.
111
+
8. Type **Powershell.exe** for the **Program/script** field.
112
+
9. In the **Add arguments (optional)** field, type the following:
10. In the **Start in (optional)** field, type the location of the script file: **%SystemDrive%\\Scripts\\**.
115
+
11. On the **Conditions** tab, select the **Start only if the following network connection is available** option, select **Any connection**, and then select **OK**.
116
+
12. Sign out, and then sign in to the device to run the scheduled task.
0 commit comments