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
@@ -4,15 +4,17 @@ titleSuffix: Azure Kubernetes Service
4
4
description: Learn how to create an RDP connection with Azure Kubernetes Service (AKS) cluster Windows Server nodes for troubleshooting and maintenance tasks.
5
5
services: container-service
6
6
ms.topic: article
7
-
ms.date: 06/04/2019
7
+
ms.date: 07/06/2022
8
8
9
9
10
10
#Customer intent: As a cluster operator, I want to learn how to use RDP to connect to nodes in an AKS cluster to perform maintenance or troubleshoot a problem.
11
11
---
12
12
13
13
# Connect with RDP to Azure Kubernetes Service (AKS) cluster Windows Server nodes for maintenance or troubleshooting
14
14
15
-
Throughout the lifecycle of your Azure Kubernetes Service (AKS) cluster, you may need to access an AKS Windows Server node. This access could be for maintenance, log collection, or other troubleshooting operations. You can access the AKS Windows Server nodes using RDP. Alternatively, if you want to use SSH to access the AKS Windows Server nodes and you have access to the same keypair that was used during cluster creation, you can follow the steps in [SSH into Azure Kubernetes Service (AKS) cluster nodes][ssh-steps]. For security purposes, the AKS nodes are not exposed to the internet.
15
+
Throughout the lifecycle of your Azure Kubernetes Service (AKS) cluster, you may need to access an AKS Windows Server node. This access could be for maintenance, log collection, or other troubleshooting operations. You can access the AKS Windows Server nodes using RDP. For security purposes, the AKS nodes aren't exposed to the internet.
16
+
17
+
Alternatively, if you want to SSH to your AKS Windows Server nodes, you'll need access to the same key-pair that was used during cluster creation. Follow the steps in [SSH into Azure Kubernetes Service (AKS) cluster nodes][ssh-steps].
16
18
17
19
This article shows you how to create an RDP connection with an AKS node using their private IP addresses.
18
20
@@ -22,13 +24,13 @@ This article shows you how to create an RDP connection with an AKS node using th
22
24
23
25
This article assumes that you have an existing AKS cluster with a Windows Server node. If you need an AKS cluster, see the article on [creating an AKS cluster with a Windows container using the Azure CLI][aks-quickstart-windows-cli]. You need the Windows administrator username and password for the Windows Server node you want to troubleshoot. You also need an RDP client such as [Microsoft Remote Desktop][rdp-mac].
24
26
25
-
If you need to reset the password you can use `az aks update` to change the password.
27
+
If you need to reset the password, use `az aks update` to change the password.
26
28
27
29
```azurecli-interactive
28
30
az aks update -g myResourceGroup -n myAKSCluster --windows-admin-password $WINDOWS_ADMIN_PASSWORD
29
31
```
30
32
31
-
If you need to reset both the username and password, see [Reset Remote Desktop Services or its administrator password in a Windows VM
33
+
If you need to reset the username and password, see [Reset Remote Desktop Services or its administrator password in a Windows VM
You also need the Azure CLI version 2.0.61 or later installed and configured. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].
@@ -37,15 +39,15 @@ You also need the Azure CLI version 2.0.61 or later installed and configured. Ru
37
39
38
40
This article assumes that you have an existing AKS cluster with a Windows Server node. If you need an AKS cluster, see the article on [creating an AKS cluster with a Windows container using the Azure PowerShell][aks-quickstart-windows-powershell]. You need the Windows administrator username and password for the Windows Server node you want to troubleshoot. You also need an RDP client such as [Microsoft Remote Desktop][rdp-mac].
39
41
40
-
If you need to reset the password you can use `Set-AzAksCluster` to change the password.
42
+
If you need to reset the password, use `Set-AzAksCluster` to change the password.
You also need the Azure PowerShell version 7.5.0 or later installed and configured. Run `Get-InstalledModule -Name Az` to find the version. If you need to install or upgrade, see [Install Azure PowerShell][install-azure-powershell].
@@ -60,7 +62,11 @@ The following example creates a virtual machine named *myVM* in the *myResourceG
60
62
61
63
### [Azure CLI](#tab/azure-cli)
62
64
63
-
First, get the subnet used by your Windows Server node pool. To get the subnet ID, you need the name of the subnet. To get the name of the subnet, you need the name of the VNet. Get the VNet name by querying your cluster for its list of networks. To query the cluster, you need its name. You can get all of these by running the following in the Azure Cloud Shell:
65
+
You'll need to get the subnet ID used by your Windows Server node pool. The commands below will query for the following information:
66
+
* The cluster's node resource group
67
+
* The virtual network
68
+
* The subnet's name
69
+
* The subnet ID
64
70
65
71
```azurecli-interactive
66
72
CLUSTER_RG=$(az aks show -g myResourceGroup -n myAKSCluster --query nodeResourceGroup -o tsv)
SUBNET_ID=$(az network vnet subnet show -g $CLUSTER_RG --vnet-name $VNET_NAME --name $SUBNET_NAME --query id -o tsv)
70
76
```
71
77
72
-
Now that you have the SUBNET_ID, run the following command in the same Azure Cloud Shell window to create the VM:
78
+
Now that you've the SUBNET_ID, run the following command in the same Azure Cloud Shell window to create the VM:
73
79
74
80
```azurecli-interactive
81
+
PUBLIC_IP_ADDRESS="myVMPublicIP"
82
+
75
83
az vm create \
76
84
--resource-group myResourceGroup \
77
85
--name myVM \
78
86
--image win2019datacenter \
79
87
--admin-username azureuser \
80
-
--admin-password myP@ssw0rd12 \
88
+
--admin-password {admin-password} \
81
89
--subnet $SUBNET_ID \
90
+
--nic-delete-option delete \
91
+
--os-disk-delete-option delete \
92
+
--nsg "" \
93
+
--public-ip-address $PUBLIC_IP_ADDRESS \
82
94
--query publicIpAddress -o tsv
83
95
```
84
96
@@ -88,11 +100,15 @@ The following example output shows the VM has been successfully created and disp
88
100
13.62.204.18
89
101
```
90
102
91
-
Record the public IP address of the virtual machine. You will use this address in a later step.
103
+
Record the public IP address of the virtual machine. You'll use this address in a later step.
92
104
93
105
### [Azure PowerShell](#tab/azure-powershell)
94
106
95
-
First, get the subnet used by your Windows Server node pool. You need the name of the subnet and its address prefix. To get the name of the subnet, you need the name of the VNet. Get the VNet name by querying your cluster for its list of networks. To query the cluster, you need its name. You can get all of these by running the following in the Azure Cloud Shell:
107
+
You'll need to get the subnet ID used by your Windows Server node pool. The commands below will query for the following information:
aksnpwin000000 Ready agent 13h v1.12.7 10.240.0.67 <none> Windows Server Datacenter 10.0.17763.437
240
265
```
241
266
242
-
Record the internal IP address of the Windows Server node you wish to troubleshoot. You will use this address in a later step.
267
+
Record the internal IP address of the Windows Server node you wish to troubleshoot. You'll use this address in a later step.
243
268
244
269
## Connect to the virtual machine and node
245
270
@@ -251,7 +276,7 @@ After you've connected to your virtual machine, connect to the *internal IP addr
251
276
252
277

253
278
254
-
You are now connected to your Windows Server node.
279
+
You're now connected to your Windows Server node.
255
280
256
281

257
282
@@ -264,18 +289,29 @@ You can now run any troubleshooting commands in the *cmd* window. Since Windows
264
289
When done, exit the RDP connection to the Windows Server node then exit the RDP session to the virtual machine. After you exit both RDP sessions, delete the virtual machine with the [az vm delete][az-vm-delete] command:
265
290
266
291
```azurecli-interactive
267
-
az vm delete --resource-group myResourceGroup --name myVM
292
+
# Delete the virtual machine
293
+
az vm delete \
294
+
--resource-group myResourceGroup \
295
+
--name myVM
268
296
```
269
297
270
-
And the NSG rule:
298
+
Delete the public IP associated with the virtual machine:
271
299
272
300
```azurecli-interactive
273
-
CLUSTER_RG=$(az aks show -g myResourceGroup -n myAKSCluster --query nodeResourceGroup -o tsv)
274
-
NSG_NAME=$(az network nsg list -g $CLUSTER_RG --query [].name -o tsv)
1. Select **Overview**, and select your Windows node pool virtual machine scale set.
378
+
1. Under **Settings**, select **Instances**. Select a Windows server node that you'd like to connect to.
379
+
1. Under **Support + troubleshooting**, select **Bastion**.
380
+
1. Enter the credentials you set up when the AKS cluster was created. Select **Connect**.
381
+
382
+
You can now run any troubleshooting commands in the *cmd* window. Since Windows Server nodes use Windows Server Core, there's not a full GUI or other GUI tools when you connect to a Windows Server node over RDP.
383
+
384
+
> [!NOTE]
385
+
> If you close out of the terminal window, press **CTRL + ALT + End**, select **Task Manager**, select **More details**, select **File**, select **Run new task**, and enter **cmd.exe** to open another terminal. You can also logout and re-connect with Bastion.
386
+
387
+
### Remove Bastion access
388
+
389
+
When you're finished, exit the Bastion session and remove the Bastion resource.
390
+
391
+
1. In the Azure portal, go to **Bastion** and select the Bastion resource you created.
392
+
1. At the top of the page, select **Delete**. Wait until the process is complete before proceeding to the next step.
393
+
1. In the Azure portal, go to **Virtual networks**. Select the virtual network that your AKS cluster is connected to.
394
+
1. Under **Settings**, select **Subnet**, and delete the **AzureBastionSubnet** subnet that was created for the Bastion resource.
395
+
302
396
## Next steps
303
397
304
-
If you need additional troubleshooting data, you can [view the Kubernetes master node logs][view-master-logs] or [Azure Monitor][azure-monitor-containers].
398
+
If you need more troubleshooting data, you can [view the Kubernetes primary node logs][view-primary-logs] or [Azure Monitor][azure-monitor-containers].
0 commit comments