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
Copy file name to clipboardExpand all lines: articles/aks/learn/quick-windows-container-deploy-cli.md
+35-30Lines changed: 35 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Create a Windows Server container on an Azure Kubernetes Service (AKS) cl
3
3
description: Learn how to quickly create a Kubernetes cluster and deploy an application in a Windows Server container in Azure Kubernetes Service (AKS) using Azure CLI.
#Customer intent: As a developer or cluster operator, I want to quickly create an AKS cluster and deploy a Windows Server container so that I can see how to run applications running on a Windows Server container using the managed Kubernetes service in Azure.
8
8
---
9
9
@@ -16,7 +16,9 @@ Azure Kubernetes Service (AKS) is a managed Kubernetes service that lets you qui
16
16
This article assumes a basic understanding of Kubernetes concepts. For more information, see [Kubernetes core concepts for Azure Kubernetes Service (AKS)](../concepts-clusters-workloads.md).
- This article requires version 2.0.64 or later of the Azure CLI. If you are using Azure Cloud Shell, then the latest version is already installed.
21
23
- Make sure that the identity you're using to create your cluster has the appropriate minimum permissions. For more details on access and identity for AKS, see [Access and identity options for Azure Kubernetes Service (AKS)](../concepts-identity.md).
22
24
- If you have multiple Azure subscriptions, select the appropriate subscription ID in which the resources should be billed using the [az account](/cli/azure/account) command.
@@ -25,7 +27,7 @@ This article assumes a basic understanding of Kubernetes concepts. For more info
25
27
26
28
An [Azure resource group](../../azure-resource-manager/management/overview.md) is a logical group in which Azure resources are deployed and managed. When you create a resource group, you're asked to specify a location. This location is where resource group metadata is stored and where your resources run in Azure if you don't specify another region during resource creation.
27
29
28
-
- Create a resource group using the [az group create][az-group-create] command. The following example creates a resource group named *myResourceGroup* in the *eastus* location.
30
+
- Create a resource group using the [az group create][az-group-create] command. The following example creates a resource group named *myResourceGroup* in the *eastus* location. Enter this command and other commands in this article into a BASH shell:
29
31
30
32
```azurecli
31
33
az group create --name myResourceGroup --location eastus
@@ -51,20 +53,19 @@ An [Azure resource group](../../azure-resource-manager/management/overview.md) i
51
53
52
54
In this section, we create an AKS cluster with the following configuration:
53
55
54
-
- The cluster is configured with two nodes to ensure it operates reliably.
56
+
- The cluster is configured with two nodes to ensure it operates reliably. A [node](../concepts-clusters-workloads.md#nodes-and-node-pools) is an Azure virtual machine (VM) that runs the Kubernetes node components and container runtime.
55
57
- The `--windows-admin-password` and `--windows-admin-username` parameters set the administrator credentials for any Windows Server nodes on the cluster and must meet [Windows Server password requirements][windows-server-password].
56
58
- The node pool uses `VirtualMachineScaleSets`.
57
59
58
-
> [!NOTE]
59
-
> To run an AKS cluster that supports node pools for Windows Server containers, your cluster needs to use a network policy that uses [Azure CNI (advanced)][azure-cni] network plugin.
60
+
To create the AKS cluster with Azure CLI, follow these steps:
60
61
61
-
1. Create a username to use as administrator credentials for the Windows Server nodes on your cluster. The following commands prompt you for a username and set it to *WINDOWS_USERNAME* for use in a later command (remember the commands in this article are entered into a BASH shell).
62
+
1. Create a username to use as administrator credentials for the Windows Server nodes on your cluster. The following commands prompt you for a username and set it to *WINDOWS_USERNAME* for use in a later command.
62
63
63
64
```azurecli
64
65
echo "Please enter the username to use as administrator credentials for Windows Server nodes on your cluster: " && read WINDOWS_USERNAME
65
66
```
66
67
67
-
1. Create a password for the administrator username you created in the previous step.
68
+
1. Create a password for the administrator username you created in the previous step. The password must be a minimum of 14 characters and meet the [Windows Server password complexity requirements][windows-server-password].
68
69
69
70
```azurecli
70
71
echo "Please enter the password to use as administrator credentials for Windows Server nodes on your cluster: " && read WINDOWS_PASSWORD
@@ -85,21 +86,23 @@ In this section, we create an AKS cluster with the following configuration:
85
86
--network-plugin azure
86
87
```
87
88
88
-
If you get a password validation error, verify the password you set meets the [Windows Server password requirements][windows-server-password]. Also see [What are the password requirements when creating a VM?](/azure/virtual-machines/windows/faq#what-are-the-password-requirements-when-creating-a-vm-). If your password meets the requirements, try creating your resource group in another region. Then try creating the cluster with the new resource group.
89
+
After a few minutes, the command completes and returns JSON-formatted information about the cluster. Occasionally, the cluster can take longer than a few minutes to provision. Allow up to 10 minutes for provisioning.
90
+
91
+
If you get a password validation error, and the password that you set meets the length and complexity requirements, try creating your resource group in another region. Then try creating the cluster with the new resource group.
89
92
90
93
If you don't specify an administrator username and password when creating the node pool, the username is set to *azureuser* and the password is set to a random value. For more information, see [How do I change the administrator password for Windows Server nodes on my cluster?](../windows-faq.md#how-do-i-change-the-administrator-password-for-windows-server-nodes-on-my-cluster).
91
94
92
-
The administrator username can't be changed, but you can change the administrator password your AKS cluster uses for Windows Server nodes using `az aks update`. For more information, see [Windows Server node pools FAQ][win-faq-change-admin-creds].
95
+
The administrator username can't be changed, but you can change the administrator password that your AKS cluster uses for Windows Server nodes using `az aks update`. For more information, see [Windows Server node pools FAQ][win-faq-change-admin-creds].
93
96
94
-
After a few minutes, the command completes and returns JSON-formatted information about the cluster. Occasionally, the cluster can take longer than a few minutes to provision. Allow up to 10 minutes for provisioning.
97
+
To run an AKS cluster that supports node pools for Windows Server containers, your cluster needs to use a network policy that uses [Azure CNI (advanced)][azure-cni] network plugin. The `--network-plugin azure` parameter specifies Azure CNI.
95
98
96
99
## Add a node pool
97
100
98
101
By default, an AKS cluster is created with a node pool that can run Linux containers. You must add another node pool that can run Windows Server containers alongside the Linux node pool.
99
102
100
103
Windows Server 2022 is the default operating system for Kubernetes versions 1.25.0 and higher. Windows Server 2019 is the default OS for earlier versions. If you don't specify a particular OS SKU, Azure creates the new node pool with the default SKU for the version of Kubernetes used by the cluster.
101
104
102
-
### [Add a Windows node pool (default SKU)](#tab/add-windows-node-pool)
105
+
### [Windows node pool (default SKU)](#tab/add-windows-node-pool)
103
106
104
107
To use the default OS SKU, create the node pool without specifying an OS SKU. The node pool is configured for the default operating system based on the Kubernetes version of the cluster.
105
108
@@ -114,46 +117,46 @@ az aks nodepool add \
114
117
--node-count 1
115
118
```
116
119
117
-
### [Add a Windows Server 2019 node pool](#tab/add-windows-server-2019-node-pool)
120
+
### [Windows Server 2022 node pool](#tab/add-windows-server-2022-node-pool)
118
121
119
-
To use Windows Server 2019, specify the following parameters:
122
+
To use Windows Server 2022, specify the following parameters:
120
123
121
124
-`os-type` set to `Windows`
122
-
-`os-sku` set to `Windows2019`
125
+
-`os-sku` set to `Windows2022`
123
126
124
127
> [!NOTE]
125
-
> Windows Server 2019 is being retired after Kubernetes version 1.32 reaches end of life (EOL) and won't be supported in future releases. For more information about this retirement, see the [AKS release notes][aks-release-notes].
128
+
> Windows Server 2022 requires Kubernetes version 1.23.0 or higher.
126
129
127
-
Add a Windows Server 2019 node pool using the `az aks nodepool add` command:
130
+
Add a Windows Server 2022 node pool using the `az aks nodepool add` command:
128
131
129
132
```azurecli
130
133
az aks nodepool add \
131
134
--resource-group myResourceGroup \
132
135
--cluster-name myAKSCluster \
133
136
--os-type Windows \
134
-
--os-sku Windows2019 \
137
+
--os-sku Windows2022 \
135
138
--name npwin \
136
139
--node-count 1
137
140
```
138
141
139
-
### [Add a Windows Server 2022 node pool](#tab/add-windows-server-2022-node-pool)
142
+
### [Windows Server 2019 node pool](#tab/add-windows-server-2019-node-pool)
140
143
141
-
To use Windows Server 2022, specify the following parameters:
144
+
To use Windows Server 2019, specify the following parameters:
142
145
143
146
-`os-type` set to `Windows`
144
-
-`os-sku` set to `Windows2022`
147
+
-`os-sku` set to `Windows2019`
145
148
146
149
> [!NOTE]
147
-
> Windows Server 2022 requires Kubernetes version 1.23.0 or higher.
150
+
> Windows Server 2019 is being retired after Kubernetes version 1.32 reaches end of life (EOL) and won't be supported in future releases. For more information about this retirement, see the [AKS release notes][aks-release-notes].
148
151
149
-
Add a Windows Server 2022 node pool using the `az aks nodepool add` command:
152
+
Add a Windows Server 2019 node pool using the `az aks nodepool add` command:
150
153
151
154
```azurecli
152
155
az aks nodepool add \
153
156
--resource-group myResourceGroup \
154
157
--cluster-name myAKSCluster \
155
158
--os-type Windows \
156
-
--os-sku Windows2022 \
159
+
--os-sku Windows2019 \
157
160
--name npwin \
158
161
--node-count 1
159
162
```
@@ -162,7 +165,7 @@ az aks nodepool add \
162
165
163
166
## Connect to the cluster
164
167
165
-
You use [kubectl][kubectl], the Kubernetes command-line client, to manage your Kubernetes clusters. If you use Azure Cloud Shell, `kubectl` is already installed. To you want to install `kubectl` locally, you can use the [az aks install-cli][az-aks-install-cli] command.
168
+
You use [kubectl][kubectl], the Kubernetes command-line client, to manage your Kubernetes clusters. If you use Azure Cloud Shell, `kubectl` is already installed. If you want to install `kubectl` locally, you can use the [az aks install-cli][az-aks-install-cli] command.
166
169
167
170
1. Configure `kubectl` to connect to your Kubernetes cluster using the [az aks get-credentials][az-aks-get-credentials] command. This command downloads credentials and configures the Kubernetes CLI to use them.
168
171
@@ -180,13 +183,13 @@ You use [kubectl][kubectl], the Kubernetes command-line client, to manage your K
180
183
181
184
```output
182
185
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
aksnpwin000000 Ready agent 20h v1.27.7 10.224.0.62 <none> Windows Server 2022 Datacenter 10.0.20348.2159 containerd://1.6.21+azure
189
+
```
187
190
188
191
> [!NOTE]
189
-
> The container runtime for each node pool is shown under *CONTAINER-RUNTIME*. Notice *aksnpwin987654* begins with `docker://`, which means it uses Docker for the container runtime. Notice *aksnpwcd123456* begins with `containerd://`, which means it uses `containerd` for the container runtime.
192
+
> The container runtime for each node pool is shown under *CONTAINER-RUNTIME*. The container runtime values begin with `containerd://`, which means that they each use `containerd` for the container runtime.
190
193
191
194
## Deploy the application
192
195
@@ -241,6 +244,8 @@ The ASP.NET sample application is provided as part of the [.NET Framework Sample
241
244
242
245
For a breakdown of YAML manifest files, see [Deployments and YAML manifests](../concepts-clusters-workloads.md#deployments-and-yaml-manifests).
243
246
247
+
If you create and save the YAML file locally, then you can upload the manifest file to your default directory in CloudShell by selecting the **Upload/Download files** button and selecting the file from your local file system.
248
+
244
249
1. Deploy the application using the [kubectl apply][kubectl-apply] command and specify the name of your YAML manifest.
@@ -171,7 +174,8 @@ The ASP.NET sample application is provided as part of the [.NET Framework Sample
171
174
172
175
For a breakdown of YAML manifest files, see [Deployments and YAML manifests](../concepts-clusters-workloads.md#deployments-and-yaml-manifests).
173
176
174
-
1. If you create and save the YAML file locally, then you can upload the manifest file to your default directory in CloudShell by selecting the **Upload/Download files** button and selecting the file from your local file system.
177
+
If you create and save the YAML file locally, then you can upload the manifest file to your default directory in CloudShell by selecting the **Upload/Download files** button and selecting the file from your local file system.
178
+
175
179
1. Deploy the application using the [`kubectl apply`][kubectl-apply] command and specify the name of your YAML manifest.
0 commit comments