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/rdp.md
+155-5Lines changed: 155 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ This article shows you how to create an RDP connection with an AKS node using th
18
18
19
19
## Before you begin
20
20
21
+
### [Azure CLI](#tab/azure-cli)
22
+
21
23
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].
22
24
23
25
If you need to reset the password you can use `az aks update` to change the password.
@@ -31,13 +33,34 @@ If you need to reset both the username and password, see [Reset Remote Desktop S
31
33
32
34
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].
33
35
36
+
### [Azure PowerShell](#tab/azure-powershell)
37
+
38
+
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
+
40
+
If you need to reset the password you can 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].
52
+
53
+
---
54
+
34
55
## Deploy a virtual machine to the same subnet as your cluster
35
56
36
57
The Windows Server nodes of your AKS cluster don't have externally accessible IP addresses. To make an RDP connection, you can deploy a virtual machine with a publicly accessible IP address to the same subnet as your Windows Server nodes.
37
58
38
59
The following example creates a virtual machine named *myVM* in the *myResourceGroup* resource group.
39
60
40
-
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:
61
+
### [Azure CLI](#tab/azure-cli)
62
+
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:
41
64
42
65
```azurecli-interactive
43
66
CLUSTER_RG=$(az aks show -g myResourceGroup -n myAKSCluster --query nodeResourceGroup -o tsv)
@@ -67,6 +90,56 @@ The following example output shows the VM has been successfully created and disp
67
90
68
91
Record the public IP address of the virtual machine. You will use this address in a later step.
69
92
93
+
### [Azure PowerShell](#tab/azure-powershell)
94
+
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:
The following example output shows the VM has been successfully created and displays the public IP address of the virtual machine.
134
+
135
+
```console
136
+
13.62.204.18
137
+
```
138
+
139
+
Record the public IP address of the virtual machine. You will use this address in a later step.
140
+
141
+
---
142
+
70
143
## Allow access to the virtual machine
71
144
72
145
AKS node pool subnets are protected with NSGs (Network Security Groups) by default. To get access to the virtual machine, you'll have to enabled access in the NSG.
@@ -75,7 +148,9 @@ AKS node pool subnets are protected with NSGs (Network Security Groups) by defau
75
148
> The NSGs are controlled by the AKS service. Any change you make to the NSG will be overwritten at any time by the control plane.
76
149
>
77
150
78
-
First, get the resource group and nsg name of the nsg to add the rule to:
151
+
### [Azure CLI](#tab/azure-cli)
152
+
153
+
First, get the resource group and name of the NSG to add the rule to:
79
154
80
155
```azurecli-interactive
81
156
CLUSTER_RG=$(az aks show -g myResourceGroup -n myAKSCluster --query nodeResourceGroup -o tsv)
@@ -88,11 +163,42 @@ Then, create the NSG rule:
88
163
az network nsg rule create --name tempRDPAccess --resource-group $CLUSTER_RG --nsg-name $NSG_NAME --priority 100 --destination-port-range 3389 --protocol Tcp --description "Temporary RDP access to Windows nodes"
89
164
```
90
165
166
+
### [Azure PowerShell](#tab/azure-powershell)
167
+
168
+
First, get the resource group and name of the NSG to add the rule to:
To manage a Kubernetes cluster, you use [kubectl][kubectl], the Kubernetes command-line client. If you use Azure Cloud Shell, `kubectl` is already installed. To install `kubectl` locally, use the [az aks install-cli][az-aks-install-cli] command:
94
200
95
-
```azurecli-interactive
201
+
```azurecli
96
202
az aks install-cli
97
203
```
98
204
@@ -102,13 +208,29 @@ To configure `kubectl` to connect to your Kubernetes cluster, use the [az aks ge
102
208
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
103
209
```
104
210
211
+
### [Azure PowerShell](#tab/azure-powershell)
212
+
213
+
To manage a Kubernetes cluster, you use [kubectl][kubectl], the Kubernetes command-line client. If you use Azure Cloud Shell, `kubectl` is already installed. To install `kubectl` locally, use the [Install-AzAksKubectl][install-azakskubectl] cmdlet:
214
+
215
+
```azurepowershell
216
+
Install-AzAksKubectl
217
+
```
218
+
219
+
To configure `kubectl` to connect to your Kubernetes cluster, use the [Import-AzAksCredential][import-azakscredential] cmdlet. This command downloads credentials and configures the Kubernetes CLI to use them.
List the internal IP address of the Windows Server nodes using the [kubectl get][kubectl-get] command:
106
228
107
229
```console
108
230
kubectl get nodes -o wide
109
231
```
110
232
111
-
The follow example output shows the internal IP addresses of all the nodes in the cluster, including the Windows Server nodes.
233
+
The following example output shows the internal IP addresses of all the nodes in the cluster, including the Windows Server nodes.
112
234
113
235
```console
114
236
$ kubectl get nodes -o wide
@@ -137,6 +259,8 @@ You can now run any troubleshooting commands in the *cmd* window. Since Windows
137
259
138
260
## Remove RDP access
139
261
262
+
### [Azure CLI](#tab/azure-cli)
263
+
140
264
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:
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 [Remove-AzVM][remove-azvm] command:
If you need additional troubleshooting data, you can [view the Kubernetes master node logs][view-master-logs] or [Azure Monitor][azure-monitor-containers].
@@ -165,10 +310,15 @@ If you need additional troubleshooting data, you can [view the Kubernetes master
0 commit comments