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/access-private-cluster.md
+54-10Lines changed: 54 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,15 @@
1
1
---
2
-
title: Use `command invoke` to access a private Azure Kubernetes Service (AKS) cluster
3
-
description: Learn how to use `command invoke` to access a private Azure Kubernetes Service (AKS) cluster
2
+
title: Access a private Azure Kubernetes Service (AKS) cluster
3
+
description: Learn how to access a private Azure Kubernetes Service (AKS) cluster using the Azure CLI or Azure portal.
4
4
ms.topic: article
5
-
ms.date: 05/03/2023
5
+
ms.date: 09/15/2023
6
6
---
7
7
8
-
# Use `command invoke` to access a private Azure Kubernetes Service (AKS) cluster
8
+
# Access a private Azure Kubernetes Service (AKS) cluster
9
9
10
-
When you access a private AKS cluster, you must connect to the cluster from the cluster virtual network, from a peered network, or via a configured private endpoint. These approaches require configuring a VPN, Express Route, deploying a *jumpbox* within the cluster virtual network, or creating a private endpoint inside of another virtual network. You can also use `command invoke` to access private clusters without the need to configure a VPN or Express Route. `command invoke` allows you to remotely invoke commands, like `kubectl` and `helm`, on your private cluster through the Azure API without directly connecting to the cluster. The `Microsoft.ContainerService/managedClusters/runcommand/action` and `Microsoft.ContainerService/managedclusters/commandResults/read` actions control the permissions for using `command invoke`.
10
+
When you access a private AKS cluster, you must connect to the cluster from the cluster virtual network, from a peered network, or via a configured private endpoint. These approaches require configuring a VPN, Express Route, deploying a *jumpbox* within the cluster virtual network, or creating a private endpoint inside of another virtual network.
11
+
12
+
With the Azure CLI, you can use `command invoke` to access private clusters without the need to configure a VPN or Express Route. `command invoke` allows you to remotely invoke commands, like `kubectl` and `helm`, on your private cluster through the Azure API without directly connecting to the cluster. The `Microsoft.ContainerService/managedClusters/runcommand/action` and `Microsoft.ContainerService/managedclusters/commandResults/read` actions control the permissions for using `command invoke`. With the Azure portal, you can use the `Run command` feature to run commands on your private cluster. The `Run command` feature uses the same `command invoke` functionality to run commands on your cluster.
11
13
12
14
## Prerequisites
13
15
@@ -21,7 +23,11 @@ The pod created by the `run` command provides `helm` and the latest compatible v
21
23
22
24
`command invoke` runs the commands from your cluster, so any commands run in this manner are subject to your configured networking restrictions and any other configured restrictions. Make sure there are enough nodes and resources in your cluster to schedule this command pod.
* Run a command on your cluster using the `az aks command invoke --command` command. The following example command runs the `kubectl get pods -n kube-system` command on the *myPrivateCluster* cluster in *myResourceGroup*.
27
33
@@ -32,7 +38,7 @@ The pod created by the `run` command provides `helm` and the latest compatible v
32
38
--command "kubectl get pods -n kube-system"
33
39
```
34
40
35
-
## Use `command invoke` to run multiple commands
41
+
### Use `command invoke` to run multiple commands
36
42
37
43
* Run multiple commands on your cluster using the `az aks command invoke --command` command. The following example command runs three `helm` commands on the *myPrivateCluster* cluster in *myResourceGroup*.
38
44
@@ -43,7 +49,7 @@ The pod created by the `run` command provides `helm` and the latest compatible v
## Use `command invoke` to run commands with an attached file or directory
52
+
### Use `command invoke` to run commands with an attached file or directory
47
53
48
54
* Run commands with an attached file or directory using the `az aks command invoke --command` command with the `--file` parameter. The following example command runs `kubectl apply -f deployment.yaml -n default` on the *myPrivateCluster* cluster in *myResourceGroup*. The `deployment.yaml` file is attached from the current directory on the development computer where `az aks command invoke` was run.
49
55
@@ -55,7 +61,7 @@ The pod created by the `run` command provides `helm` and the latest compatible v
55
61
--file deployment.yaml
56
62
```
57
63
58
-
### Use `command invoke` to run commands with all files in the current directory attached
64
+
#### Use `command invoke` to run commands with all files in the current directory attached
59
65
60
66
* Run commands with all files in the current directory attached using the `az aks command invoke --command` command with the `--file` parameter. The following example command runs `kubectl apply -f deployment.yaml configmap.yaml -n default` on the *myPrivateCluster* cluster in *myResourceGroup*. The `deployment.yaml` and `configmap.yaml` files are part of the current directory on the development computer where `az aks command invoke` was run.
61
67
@@ -67,13 +73,51 @@ The pod created by the `run` command provides `helm` and the latest compatible v
To get started with `Run command`, navigate to your private cluster in the Azure portal. Under the **Kubernetes resources** section, select **Run command**.
79
+
80
+
:::image type="content" source="media/access-private-cluster/azure-portal-run-command.png" alt-text="Screenshot of browsing to the Azure portal Run command feature.":::
81
+
82
+
### `Run command` commands
83
+
84
+
You can use the following kubectl commands with the `Run command` feature:
85
+
86
+
* `kubectl get nodes`
87
+
* `kubectl get deployments`
88
+
* `kubectl get pods`
89
+
* `kubectl describe nodes`
90
+
* `kubectl describe pod <pod-name>`
91
+
* `kubectl describe deployment <deployment-name>`
92
+
* `kubectl apply -f <file-name`
93
+
94
+
### Use `Run command` to run a single command
95
+
96
+
1. In the Azure portal, navigate to your private cluster.
97
+
2. Under the **Kubernetes resources** section, select **Run command**.
98
+
3. Enter the command you want to run and select **Run**.
99
+
100
+
### Use `Run command` to run commands with attached files
101
+
102
+
1. In the Azure portal, navigate to your private cluster.
103
+
2. Under the **Kubernetes resources** section, select **Run command**.
104
+
3. Select **Attach files**.
105
+
4. Select **Browse for files**.
106
+
107
+
:::image type="content" source="media/access-private-cluster/azure-portal-run-command-attach-files.png" alt-text="Screenshot of attaching files to the Azure portal Run command.":::
108
+
109
+
5. Select the file(s) you want to attach and then select **Attach**.
110
+
6. Enter the command you want to run and select **Run**.
111
+
112
+
--
113
+
70
114
## Troubleshooting
71
115
72
116
For information on the most common issues with `az aks command invoke` and how to fix them, see [Resolve `az aks command invoke` failures][command-invoke-troubleshoot].
73
117
74
118
## Next steps
75
119
76
-
In this article, you learned how to use `command invoke` to access a private cluster and run commands on that cluster. For more information on AKS clusters, see the following articles:
120
+
In this article, you learned how to access a private cluster and run commands on that cluster. For more information on AKS clusters, see the following articles:
77
121
78
122
* [Use a private endpoint connection in AKS](./private-clusters.md#use-a-private-endpoint-connection)
79
123
* [Virtual networking peering in AKS](./private-clusters.md#virtual-network-peering)
Copy file name to clipboardExpand all lines: articles/chaos-studio/chaos-studio-tutorial-aks-cli.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Chaos Studio uses [Chaos Mesh](https://chaos-mesh.org/), a free, open-source cha
23
23
24
24
## Limitations
25
25
26
-
* You can use Chaos Mesh faults with private clusters by configuring [VNet Injection in Chaos Studio](chaos-studio-private-networking.md). Any commands issued to the private cluster, including the steps in this article to set up Chaos Mesh, need to follow the [private cluster guidance](../aks/private-clusters.md). Recommended methods include connecting from a VM in the same virtual network or using the [AKS command invoke](../aks/command-invoke.md) feature.
26
+
* You can use Chaos Mesh faults with private clusters by configuring [VNet Injection in Chaos Studio](chaos-studio-private-networking.md). Any commands issued to the private cluster, including the steps in this article to set up Chaos Mesh, need to follow the [private cluster guidance](../aks/private-clusters.md). Recommended methods include connecting from a VM in the same virtual network or using the [AKS command invoke](../aks/access-private-cluster.md) feature.
27
27
* AKS Chaos Mesh faults are only supported on Linux node pools.
28
28
* Currently, Chaos Mesh faults don't work if the AKS cluster has [local accounts disabled](../aks/manage-local-accounts-managed-azure-ad.md).
29
29
* If your AKS cluster is configured to only allow authorized IP ranges, you need to allow Chaos Studio's IP ranges. You can find them by querying the `ChaosStudio`[service tag with the Service Tag Discovery API or downloadable JSON files](../virtual-network/service-tags-overview.md).
Copy file name to clipboardExpand all lines: articles/chaos-studio/chaos-studio-tutorial-aks-portal.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Chaos Studio uses [Chaos Mesh](https://chaos-mesh.org/), a free, open-source cha
22
22
23
23
## Limitations
24
24
25
-
* You can use Chaos Mesh faults with private clusters by configuring [VNet Injection in Chaos Studio](chaos-studio-private-networking.md). Any commands issued to the private cluster, including the steps in this article to set up Chaos Mesh, need to follow the [private cluster guidance](../aks/private-clusters.md). Recommended methods include connecting from a VM in the same virtual network or using the [AKS command invoke](../aks/command-invoke.md) feature.
25
+
* You can use Chaos Mesh faults with private clusters by configuring [VNet Injection in Chaos Studio](chaos-studio-private-networking.md). Any commands issued to the private cluster, including the steps in this article to set up Chaos Mesh, need to follow the [private cluster guidance](../aks/private-clusters.md). Recommended methods include connecting from a VM in the same virtual network or using the [AKS command invoke](../aks/access-private-cluster.md) feature.
26
26
* AKS Chaos Mesh faults are only supported on Linux node pools.
27
27
* Currently, Chaos Mesh faults don't work if the AKS cluster has [local accounts disabled](../aks/manage-local-accounts-managed-azure-ad.md).
28
28
* If your AKS cluster is configured to only allow authorized IP ranges, you need to allow Chaos Studio's IP ranges. You can find them by querying the `ChaosStudio`[service tag with the Service Tag Discovery API or downloadable JSON files](../virtual-network/service-tags-overview.md).
0 commit comments