Skip to content

Commit 1422b32

Browse files
authored
Merge pull request #178474 from shashankbarsin/shasb/arc-k8s-update-4
Arc-enabled K8s - portal browse
2 parents f6771e9 + 4561900 commit 1422b32

File tree

5 files changed

+105
-47
lines changed

5 files changed

+105
-47
lines changed

articles/azure-arc/kubernetes/cluster-connect.md

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Use Cluster Connect to connect to Azure Arc-enabled Kubernetes clusters"
33
services: azure-arc
44
ms.service: azure-arc
5-
ms.date: 04/05/2021
5+
ms.date: 10/31/2021
66
ms.topic: article
77
author: shashankbarsin
88
ms.author: shasb
@@ -17,94 +17,89 @@ With Cluster Connect, you can securely connect to Azure Arc-enabled Kubernetes c
1717

1818
A conceptual overview of this feature is available in [Cluster connect - Azure Arc-enabled Kubernetes](conceptual-cluster-connect.md) article.
1919

20-
[!INCLUDE [preview features note](./includes/preview/preview-callout.md)]
21-
2220
## Prerequisites
2321

2422
- [Install or upgrade Azure CLI](/cli/azure/install-azure-cli) to version >= 2.16.0
2523

2624
- Install the `connectedk8s` Azure CLI extension of version >= 1.1.0:
2725

28-
```azurecli
26+
```console
2927
az extension add --name connectedk8s
3028
```
3129
3230
If you've already installed the `connectedk8s` extension, update the extension to the latest version:
3331
34-
```azurecli
32+
```console
3533
az extension update --name connectedk8s
3634
```
3735

3836
- An existing Azure Arc-enabled Kubernetes connected cluster.
3937
- If you haven't connected a cluster yet, use our [quickstart](quickstart-connect-cluster.md).
4038
- [Upgrade your agents](agent-upgrade.md#manually-upgrade-agents) to version >= 1.1.0.
4139

42-
- Enable the Cluster Connect on any Azure Arc-enabled Kubernetes cluster by running the following command on a machine where the `kubeconfig` file is pointed to the cluster of concern:
43-
44-
```azurecli
45-
az connectedk8s enable-features --features cluster-connect -n <clusterName> -g <resourceGroupName>
46-
```
47-
4840
- Enable the below endpoints for outbound access in addition to the ones mentioned under [connecting a Kubernetes cluster to Azure Arc](quickstart-connect-cluster.md#meet-network-requirements):
4941

5042
| Endpoint | Port |
5143
|----------------|-------|
5244
|`*.servicebus.windows.net` | 443 |
5345
|`guestnotificationservice.azure.com`, `*.guestnotificationservice.azure.com` | 443 |
5446

55-
## Usage
47+
- Replace the placeholders and run the below command to set the environment variables used in this document:
5648

57-
Two authentication options are supported with the Cluster Connect feature:
58-
* Azure Active Directory (Azure AD)
59-
* Service account token
49+
```console
50+
CLUSTER_NAME=<cluster-name>
51+
RESOURCE_GROUP=<resource-group-name>
52+
ARM_ID_CLUSTER=$(az connectedk8s show -n $CLUSTER_NAME -g $RESOURCE_GROUP --query id -o tsv)
53+
```
6054

61-
### Option 1: Azure Active Directory
6255

63-
1. With the `kubeconfig` file pointing to the `apiserver` of your Kubernetes cluster, create a ClusterRoleBinding or RoleBinding to the Azure AD entity (service principal or user) requiring access:
56+
## Enable Cluster Connect feature
6457

65-
**For user:**
66-
67-
```console
68-
kubectl create clusterrolebinding admin-user-binding --clusterrole cluster-admin --user=<testuser>@<mytenant.onmicrosoft.com>
69-
```
58+
You can enable the Cluster Connect on any Azure Arc-enabled Kubernetes cluster by running the following command on a machine where the `kubeconfig` file is pointed to the cluster of concern:
7059

71-
**For Azure AD application:**
60+
```console
61+
az connectedk8s enable-features --features cluster-connect -n $CLUSTER_NAME -g $RESOURCE_GROUP
62+
```
7263

73-
1. Get the `objectId` associated with your Azure AD application:
64+
## Azure Active Directory authentication option
7465

75-
```azurecli
76-
az ad sp show --id <id> --query objectId -o tsv
77-
```
66+
1. Get the `objectId` associated with your Azure AD entity:
67+
68+
- For Azure AD user account:
7869

79-
1. Create a ClusterRoleBinding or RoleBinding to the Azure AD entity (service principal or user) that needs to access this cluster:
80-
8170
```console
82-
kubectl create clusterrolebinding admin-user-binding --clusterrole cluster-admin --user=<objectId>
71+
AAD_ENTITY_OBJECT_ID=$(az ad signed-in-user show --query objectId -o tsv)
8372
```
8473

85-
1. After logging into Azure CLI using the Azure AD entity of interest, get the Cluster Connect `kubeconfig` needed to communicate with the cluster from anywhere (from even outside the firewall surrounding the cluster):
74+
- For Azure AD application:
8675

87-
```azurecli
88-
az connectedk8s proxy -n <cluster-name> -g <resource-group-name>
89-
```
76+
```console
77+
AAD_ENTITY_OBJECT_ID=$(az ad sp show --id <id> --query objectId -o tsv)
78+
```
9079

91-
1. Use `kubectl` to send requests to the cluster:
80+
1. Authorize the AAD entity with appropriate permissions:
9281

93-
```console
94-
kubectl get pods
95-
```
82+
- If you are using Kubernetes native ClusterRoleBinding or RoleBinding for authorization checks on the cluster, with the `kubeconfig` file pointing to the `apiserver` of your cluster for direct access, you can create one mapped to the Azure AD entity (service principal or user) that needs to access this cluster. Example:
9683
97-
You should now see a response from the cluster containing the list of all pods under the `default` namespace.
84+
```console
85+
kubectl create clusterrolebinding admin-user-binding --clusterrole cluster-admin --user=$AAD_ENTITY_OBJECT_ID
86+
```
9887

99-
### Option 2: Service Account Bearer Token
88+
- If you are using Azure RBAC for authorization checks on the cluster, you can create an Azure role assignment mapped to the Azure AD entity. Example:
89+
90+
```console
91+
az role assignment create --role "Azure Arc Kubernetes Viewer" --assignee $AAD_ENTITY_OBJECT_ID --scope $ARM_ID_CLUSTER
92+
```
93+
94+
## Service account token authentication option
10095

10196
1. With the `kubeconfig` file pointing to the `apiserver` of your Kubernetes cluster, create a service account in any namespace (following command creates it in the default namespace):
10297

10398
```console
10499
kubectl create serviceaccount admin-user
105100
```
106101

107-
1. Create ClusterRoleBinding or RoleBinding to grant this [service account the appropriate permissions on the cluster](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#kubectl-create-rolebinding):
102+
1. Create ClusterRoleBinding or RoleBinding to grant this [service account the appropriate permissions on the cluster](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#kubectl-create-rolebinding). Example:
108103

109104
```console
110105
kubectl create clusterrolebinding admin-user-binding --clusterrole cluster-admin --serviceaccount default:admin-user
@@ -120,18 +115,28 @@ Two authentication options are supported with the Cluster Connect feature:
120115
TOKEN=$(kubectl get secret ${SECRET_NAME} -o jsonpath='{$.data.token}' | base64 -d | sed $'s/$/\\\n/g')
121116
```
122117

123-
1. Get the Cluster Connect `kubeconfig` needed to communicate with the cluster from anywhere (from even outside the firewall surrounding the cluster):
118+
## Access your cluster
124119

125-
```azurecli
126-
az connectedk8s proxy -n <cluster-name> -g <resource-group-name> --token $TOKEN
127-
```
120+
1. Set up the Cluster Connect based kubeconfig needed to access your cluster based on the authentication option used:
121+
122+
- If using Azure Active Directory authentication option, after logging into Azure CLI using the Azure AD entity of interest, get the Cluster Connect `kubeconfig` needed to communicate with the cluster from anywhere (from even outside the firewall surrounding the cluster):
123+
124+
```console
125+
az connectedk8s proxy -n $CLUSTER_NAME -g $RESOURCE_GROUP
126+
```
127+
128+
- If using the service account authentication option, get the Cluster Connect `kubeconfig` needed to communicate with the cluster from anywhere:
129+
130+
```console
131+
az connectedk8s proxy -n $CLUSTER_NAME -g $RESOURCE_GROUP --token $TOKEN
132+
```
128133

129134
1. Use `kubectl` to send requests to the cluster:
130135

131136
```console
132137
kubectl get pods
133138
```
134-
139+
135140
You should now see a response from the cluster containing the list of all pods under the `default` namespace.
136141

137142
## Known limitations
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: Access Kubernetes resources from Azure portal
3+
services: azure-arc
4+
ms.service: azure-arc
5+
ms.date: 10/31/2021
6+
ms.topic: article
7+
author: shashankbarsin
8+
ms.author: shasb
9+
description: Learn how to interact with Kubernetes resources to manage an Azure Arc-enabled Kubernetes cluster from the Azure portal.
10+
---
11+
12+
# Access Kubernetes resources from Azure portal
13+
14+
The Azure portal includes a Kubernetes resource view for easy access to the Kubernetes resources in your Azure Arc-enabled Kubernetes cluster. Viewing Kubernetes resources from the Azure portal reduces context switching between the Azure portal and the `kubectl` command-line tool, streamlining the experience for viewing and editing your Kubernetes resources. The resource viewer currently includes multiple resource types, such as deployments, pods, and replica sets.
15+
16+
[!INCLUDE [preview features note](./includes/preview/preview-callout.md)]
17+
18+
## Prerequisites
19+
20+
- An existing Kubernetes cluster [connected](quickstart-connect-cluster.md) to Azure as an Azure Arc-enabled Kubernetes resource.
21+
22+
- [Cluster Connect feature has to be enabled](cluster-connect.md#enable-cluster-connect-feature) on the Azure Arc-enabled Kubernetes cluster.
23+
24+
- [Service account token](cluster-connect.md#service-account-token-authentication-option) for authentication to the cluster.
25+
26+
## View Kubernetes resources
27+
28+
To see the Kubernetes resources, navigate to your AKS cluster in the Azure portal. The navigation pane on the left is used to access your resources. The resources include:
29+
30+
- **Namespaces** displays the namespaces of your cluster. The filter at the top of the namespace list provides a quick way to filter and display your namespace resources.
31+
- **Workloads** shows information about deployments, pods, replica sets, stateful sets, daemon sets, jobs, and cron jobs deployed to your cluster.
32+
- **Services and ingresses** shows all of your cluster's service and ingress resources.
33+
- **Storage** shows your Azure storage classes and persistent volume information.
34+
- **Configuration** shows your cluster's config maps and secrets.
35+
36+
[ ![Kubernetes workloads information displayed in the Azure portal](media/kubernetes-resource-view/workloads.png) ](media/kubernetes-resource-view/workloads.png#lightbox)
37+
38+
## Edit YAML
39+
40+
The Kubernetes resource view also includes a YAML editor. A built-in YAML editor means you can update Kubernetes objects from within the portal and apply changes immediately.
41+
42+
After editing the YAML, changes are applied by selecting **Review + save**, confirming the changes, and then saving again.
43+
44+
[ ![YAML editor for Kubernetes objects displayed in the Azure portal](media/kubernetes-resource-view/yaml-editor.png) ](media/kubernetes-resource-view/yaml-editor.png#lightbox)
45+
46+
>[!WARNING]
47+
> Performing direct production changes via UI or CLI is not recommended and you should consider using [Configurations (GitOps)](tutorial-use-gitops-connected-cluster.md) for production environments. The Azure portal Kubernetes management capabilities and the YAML editor are built for learning and flighting new deployments in a development and testing setting.
48+
49+
## Next steps
50+
51+
Azure Monitor for containers provides more in-depth information about nodes and containers of the cluster when compared to the logical view of the Kubernetes resources available with Kubernetes resources view described in this article. Learn how to [deploy Azure Monitor for containers](../../azure-monitor/containers/container-insights-enable-arc-enabled-clusters.md?toc=/azure/azure-arc/kubernetes/toc.json) on your cluster.
411 KB
Loading
326 KB
Loading

articles/azure-arc/kubernetes/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@
5858
href: ../../azure-monitor/containers/container-insights-enable-arc-enabled-clusters.md?toc=/azure/azure-arc/kubernetes/toc.json
5959
- name: Enforce threat protection using Azure Defender
6060
href: ../../security-center/defender-for-kubernetes-azure-arc.md?toc=/azure/azure-arc/kubernetes/toc.json
61-
- name: Admission control policy definitions using Azure Policy
61+
- name: In-cluster policy enforcements using Azure Policy
6262
href: ../../governance/policy/concepts/policy-for-kubernetes.md?toc=/azure/azure-arc/kubernetes/toc.json
6363
- name: Deploy Azure Arc-enabled Open Service Mesh
6464
href: tutorial-arc-enabled-open-service-mesh.md
6565
- name: Securely connect to cluster from anywhere
6666
href: cluster-connect.md
67+
- name: Azure portal Kubernetes resource view
68+
href: kubernetes-resource-view.md
6769
- name: Use Azure AD RBAC for authorization checks
6870
href: azure-rbac.md
6971
- name: Create custom locations

0 commit comments

Comments
 (0)