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/azure-arc/kubernetes/azure-rbac.md
+75-10Lines changed: 75 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
2
title: "Azure RBAC for Azure Arc-enabled Kubernetes clusters"
3
-
ms.date: 03/13/2023
3
+
ms.date: 04/27/2023
4
4
ms.topic: how-to
5
5
ms.custom: devx-track-azurecli
6
6
description: "Use Azure RBAC for authorization checks on Azure Arc-enabled Kubernetes clusters."
7
7
---
8
8
9
9
# Use Azure RBAC for Azure Arc-enabled Kubernetes clusters
10
10
11
-
Kubernetes [ClusterRoleBinding and RoleBinding](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding) object types help to define authorization in Kubernetes natively. By using this feature, you can use Azure Active Directory (Azure AD) and role assignments in Azure to control authorization checks on the cluster. This means that you can use Azure role assignments to granularly control who can read, write, and delete Kubernetes objects like deployment, pod, and service.
11
+
Kubernetes [ClusterRoleBinding and RoleBinding](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding) object types help to define authorization in Kubernetes natively. By using this feature, you can use Azure Active Directory (Azure AD) and role assignments in Azure to control authorization checks on the cluster. Azure role assignments let you granularly control which users can read, write, and delete Kubernetes objects such as deployment, pod, and service.
12
12
13
13
For a conceptual overview of this feature, see [Azure RBAC on Azure Arc-enabled Kubernetes](conceptual-azure-rbac.md).
14
14
@@ -39,7 +39,7 @@ For a conceptual overview of this feature, see [Azure RBAC on Azure Arc-enabled
39
39
40
40
## Set up Azure AD applications
41
41
42
-
### [AzureCLI >= v2.37](#tab/AzureCLI)
42
+
### [Azure CLI >= v2.3.7](#tab/AzureCLI)
43
43
44
44
#### Create a server application
45
45
@@ -134,7 +134,7 @@ For a conceptual overview of this feature, see [Azure RBAC on Azure Arc-enabled
> Use `--skip-azure-rbac-list` with the preceding command for a comma-separated list of usernames, emails, and OpenID connections undergoing authorization checks by using Kubernetes native `ClusterRoleBinding` and `RoleBinding` objects instead of Azure RBAC.
254
254
255
-
### Generic cluster where no reconciler is running on the apiserver specification
255
+
### Generic cluster where no reconciler is running on the `apiserver` specification
256
256
257
257
1. SSH into every master node of the cluster and take the following steps:
258
258
@@ -404,7 +404,7 @@ Owners of the Azure Arc-enabled Kubernetes resource can use either built-in role
404
404
405
405
| Role | Description |
406
406
|---|---|
407
-
| [Azure Arc Kubernetes Viewer](../../role-based-access-control/built-in-roles.md#azure-arc-kubernetes-viewer) | Allows read-only access to see most objects in a namespace. This role doesn't allow viewing secrets. This is because `read` permission on secrets would enable access to `ServiceAccount` credentials in the namespace. These credentials would in turn allow API access through that `ServiceAccount` value (a form of privilege escalation). |
407
+
| [Azure Arc Kubernetes Viewer](../../role-based-access-control/built-in-roles.md#azure-arc-kubernetes-viewer) | Allows read-only access to see most objects in a namespace. This role doesn't allow viewing secrets, because `read` permission on secrets would enable access to `ServiceAccount` credentials in the namespace. These credentials would in turn allow API access through that `ServiceAccount` value (a form of privilege escalation). |
408
408
| [Azure Arc Kubernetes Writer](../../role-based-access-control/built-in-roles.md#azure-arc-kubernetes-writer) | Allows read/write access to most objects in a namespace. This role doesn't allow viewing or modifying roles or role bindings. However, this role allows accessing secrets and running pods as any `ServiceAccount` value in the namespace, so it can be used to gain the API access levels of any `ServiceAccount` value in the namespace. |
409
409
| [Azure Arc Kubernetes Admin](../../role-based-access-control/built-in-roles.md#azure-arc-kubernetes-admin) | Allows admin access. It's intended to be granted within a namespace through `RoleBinding`. If you use it in `RoleBinding`, it allows read/write access to most resources in a namespace, including the ability to create roles and role bindings within the namespace. This role doesn't allow write access to resource quota or to the namespace itself. |
410
410
| [Azure Arc Kubernetes Cluster Admin](../../role-based-access-control/built-in-roles.md#azure-arc-kubernetes-cluster-admin) | Allows superuser access to execute any action on any resource. When you use it in `ClusterRoleBinding`, it gives full control over every resource in the cluster and in all namespaces. When you use it in `RoleBinding`, it gives full control over every resource in the role binding's namespace, including the namespace itself.|
@@ -481,6 +481,69 @@ After the proxy process is running, you can open another tab in your console to
481
481
482
482
### Use a shared kubeconfig file
483
483
484
+
Using a shared kubeconfig requires slightly different steps depending on your Kubernetes version.
485
+
486
+
### [Kubernetes version >= 1.26](#tab/kubernetes-latest)
487
+
488
+
1. Run the following command to set the credentials for the user:
1. Open the *kubeconfig* file that you created earlier. Under `contexts`, verify that the context associated with the cluster points to the user credentials that you created in the previous step. To set the current context to these user credentials, run the following command:
[Exec plugin](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins) is a Kubernetes authentication strategy that allows `kubectl` to execute an external command to receive user credentials to send to `apiserver`. Starting with Kubernetes version 1.26, the default Azure authorization plugin is no longer included in `client-go` and `kubectl`. With later versions, in order to use the exec plugin to receive user credentials you must use Azure Kubelogin, a `client-go` credential (exec) plugin that implements Azure authentication.
521
+
522
+
1. Install Azure Kubelogin:
523
+
524
+
- For Windows or Mac, follow the [Azure Kubelogin installation instructions](https://azure.github.io/kubelogin/install.html#installation).
525
+
- For Linux or Ubuntu, download the [latest version of kubelogin](https://github.com/Azure/kubelogin/releases), then run the following commands:
1. [Convert](https://azure.github.io/kubelogin/cli/convert-kubeconfig.html) the kubelogin to the appropriate [login mode](https://azure.github.io/kubelogin/concepts/login-modes.html). For example, for [device code login](https://azure.github.io/kubelogin/concepts/login-modes/devicecode.html) with an Azure Active Directory user, the commands would be as follows:
538
+
539
+
```bash
540
+
export KUBECONFIG=/path/to/kubeconfig
541
+
542
+
kubelogin convert-kubeconfig
543
+
```
544
+
545
+
### [Kubernetes < v1.26](#tab/Kubernetes-earlier)
546
+
484
547
1. Run the following command to set the credentials for the user:
485
548
486
549
```console
@@ -513,6 +576,8 @@ After the proxy process is running, you can open another tab in your console to
513
576
name: azure
514
577
```
515
578
579
+
---
580
+
516
581
## Send requests to the cluster
517
582
518
583
1. Run any `kubectl` command. For example:
@@ -575,7 +640,7 @@ Access the cluster again. For example, run the `kubectl get nodes` command to vi
575
640
kubectl get nodes
576
641
```
577
642
578
-
Follow the instructions to sign in again. An error message states that you're successfully logged in, but your admin requires the device that's requesting access to be managed by Azure AD to access the resource. Follow these steps:
643
+
Follow the instructions to sign in again. An error message states that you're successfully logged in, but your admin requires the device that's requesting access to be managed by Azure AD in order to access the resource. Follow these steps:
579
644
580
645
1. In the Azure portal, go to **Azure Active Directory**.
581
646
1. Select **Enterprise applications**. Then under **Activity**, select **Sign-ins**.
@@ -629,7 +694,7 @@ After you've made the assignments, verify that just-in-time access is working by
629
694
kubectl get nodes
630
695
```
631
696
632
-
Note the authentication requirement and follow the steps to authenticate. If authentication is successful, you should see output similar to the following:
697
+
Note the authentication requirement and follow the steps to authenticate. If authentication is successful, you should see output similar to this:
633
698
634
699
```output
635
700
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code AAAAAAAAA to authenticate.
0 commit comments