Skip to content

Commit aee9b6b

Browse files
authored
Merge pull request #250359 from schaffererin/aks-command-invoke
Updating command invoke access doc to include Azure portal run command
2 parents 66539c0 + f9ab019 commit aee9b6b

8 files changed

+63
-14
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24481,6 +24481,11 @@
2448124481
"source_path_from_root": "/articles/private-link/tutorial-private-endpoint-cosmosdb-portal.md",
2448224482
"redirect_url": "/azure/cosmos-db/how-to-configure-private-endpoints",
2448324483
"redirect_document_id": false
24484+
},
24485+
{
24486+
"source_path_from_root": "/articles/aks/command-invoke.md",
24487+
"redirect_url": "/azure/aks/access-private-cluster",
24488+
"redirect_document_id": false
2448424489
}
2448524490
]
2448624491
}

articles/aks/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
- name: Create a private cluster
224224
href: private-clusters.md
225225
- name: Access a private cluster remotely
226-
href: command-invoke.md
226+
href: access-private-cluster.md
227227
- name: Integration
228228
items:
229229
- name: Integrate ACR with an AKS cluster

articles/aks/command-invoke.md renamed to articles/aks/access-private-cluster.md

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
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.
44
ms.topic: article
5-
ms.date: 05/03/2023
5+
ms.date: 09/15/2023
66
---
77

8-
# Use `command invoke` to access a private Azure Kubernetes Service (AKS) cluster
8+
# Access a private Azure Kubernetes Service (AKS) cluster
99

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.
1113

1214
## Prerequisites
1315

@@ -21,7 +23,11 @@ The pod created by the `run` command provides `helm` and the latest compatible v
2123

2224
`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.
2325

24-
## Use `command invoke` to run a single command
26+
## Run commands on your AKS cluster
27+
28+
### [Azure CLI - `command invoke`](#tab/azure-cli)
29+
30+
### Use `command invoke` to run a single command
2531

2632
* 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*.
2733

@@ -32,7 +38,7 @@ The pod created by the `run` command provides `helm` and the latest compatible v
3238
--command "kubectl get pods -n kube-system"
3339
```
3440
35-
## Use `command invoke` to run multiple commands
41+
### Use `command invoke` to run multiple commands
3642
3743
* 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*.
3844
@@ -43,7 +49,7 @@ The pod created by the `run` command provides `helm` and the latest compatible v
4349
--command "helm repo add bitnami https://charts.bitnami.com/bitnami && helm repo update && helm install my-release bitnami/nginx"
4450
```
4551
46-
## 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
4753
4854
* 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.
4955
@@ -55,7 +61,7 @@ The pod created by the `run` command provides `helm` and the latest compatible v
5561
--file deployment.yaml
5662
```
5763
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
5965
6066
* 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.
6167
@@ -67,13 +73,51 @@ The pod created by the `run` command provides `helm` and the latest compatible v
6773
--file .
6874
```
6975
76+
### [Azure portal - `Run command`](#tab/azure-portal)
77+
78+
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+
70114
## Troubleshooting
71115
72116
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].
73117
74118
## Next steps
75119
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:
77121
78122
* [Use a private endpoint connection in AKS](./private-clusters.md#use-a-private-endpoint-connection)
79123
* [Virtual networking peering in AKS](./private-clusters.md#virtual-network-peering)
7.71 KB
Loading
80.9 KB
Loading

articles/aks/private-clusters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ For associated best practices, see [Best practices for network connectivity and
335335
[private-endpoint-service]: ../private-link/private-endpoint-overview.md
336336
[virtual-network-peering]: ../virtual-network/virtual-network-peering-overview.md
337337
[express-route-or-vpn]: ../expressroute/expressroute-about-virtual-network-gateways.md
338-
[command-invoke]: command-invoke.md
338+
[command-invoke]: ./access-private-cluster.md
339339
[container-registry-private-link]: ../container-registry/container-registry-private-link.md
340340
[virtual-networks-name-resolution]: ../virtual-network/virtual-networks-name-resolution-for-vms-and-role-instances.md#name-resolution-that-uses-your-own-dns-server
341341
[virtual-networks-168.63.129.16]: ../virtual-network/what-is-ip-address-168-63-129-16.md

articles/chaos-studio/chaos-studio-tutorial-aks-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Chaos Studio uses [Chaos Mesh](https://chaos-mesh.org/), a free, open-source cha
2323

2424
## Limitations
2525

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.
2727
* AKS Chaos Mesh faults are only supported on Linux node pools.
2828
* Currently, Chaos Mesh faults don't work if the AKS cluster has [local accounts disabled](../aks/manage-local-accounts-managed-azure-ad.md).
2929
* 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).

articles/chaos-studio/chaos-studio-tutorial-aks-portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Chaos Studio uses [Chaos Mesh](https://chaos-mesh.org/), a free, open-source cha
2222

2323
## Limitations
2424

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.
2626
* AKS Chaos Mesh faults are only supported on Linux node pools.
2727
* Currently, Chaos Mesh faults don't work if the AKS cluster has [local accounts disabled](../aks/manage-local-accounts-managed-azure-ad.md).
2828
* 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

Comments
 (0)