Skip to content

Commit ac779c2

Browse files
authored
Merge pull request #220778 from MGoedtel/UpdateAZADRBAC
Added new supporting details for verifying K8s RBAC
2 parents 7792919 + e1fc0e7 commit ac779c2

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

articles/aks/azure-ad-rbac.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ titleSuffix: Azure Kubernetes Service
44
description: Learn how to use Azure Active Directory group membership to restrict access to cluster resources using Kubernetes role-based access control (Kubernetes RBAC) in Azure Kubernetes Service (AKS)
55
services: container-service
66
ms.topic: article
7-
ms.date: 03/17/2021
7+
ms.date: 12/07/2022
88

99
---
1010

@@ -18,7 +18,34 @@ This article shows you how to control access using Kubernetes RBAC in an AKS clu
1818

1919
This article assumes that you have an existing AKS cluster enabled with Azure AD integration. If you need an AKS cluster, see [Integrate Azure Active Directory with AKS][azure-ad-aks-cli].
2020

21-
You 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].
21+
Kubernetes RBAC is enabled by default during AKS cluster creation. If Kubernetes RBAC wasn't enabled when you originally deployed your cluster, you'll need to delete and recreate your cluster.
22+
23+
Consider the following basic requirements before continuing:
24+
25+
- The Azure CLI version 2.0.61 or later is installed and configured. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].
26+
- If using Terraform, install [Terraform][terraform-on-azure] version 2.99.0 or later.
27+
28+
To verify if Kubernetes RBAC is enabled, you can check from Azure portal or Azure CLI.
29+
30+
#### [Azure portal](#tab/portal)
31+
32+
From your browser, sign in to the [Azure portal](https://portal.azure.com).
33+
34+
Navigate to Kubernetes services, and from the left-hand pane select **Cluster configuration**. On the page, under the section **Authentication and Authorization**, verify the option **Local accounts with Kubernetes RBAC** is shown.
35+
36+
:::image type="content" source="./media/azure-ad-rbac/rbac-portal.png" alt-text="Example of Authentication and Authorization page in Azure portal." lightbox="./media/azure-ad-rbac/rbac-portal.png":::
37+
38+
#### [Azure CLI](#tab/azure-cli)
39+
40+
To verify RBAC is enabled, you can use the `az aks show` command.
41+
42+
```azuecli
43+
az aks show --resource-group myResourceGroup --name myAKSCluster`
44+
```
45+
46+
The output will show that the value for `enableRbac` is `true`.
47+
48+
---
2249

2350
## Create demo groups in Azure AD
2451

@@ -280,7 +307,7 @@ kubectl apply -f rolebinding-sre-namespace.yaml
280307

281308
Now, let's test the expected permissions work when you create and manage resources in an AKS cluster. In these examples, you schedule and view pods in the user's assigned namespace. Then, you try to schedule and view pods outside of the assigned namespace.
282309

283-
First, reset the *kubeconfig* context using the [az aks get-credentials][az-aks-get-credentials] command. In a previous section, you set the context using the cluster admin credentials. The admin user bypasses Azure AD sign in prompts. Without the `--admin` parameter, the user context is applied that requires all requests to be authenticated using Azure AD.
310+
First, reset the *kubeconfig* context using the [az aks get-credentials][az-aks-get-credentials] command. In a previous section, you set the context using the cluster admin credentials. The admin user bypasses Azure AD sign-in prompts. Without the `--admin` parameter, the user context is applied that requires all requests to be authenticated using Azure AD.
284311

285312
```azurecli-interactive
286313
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster --overwrite-existing
@@ -292,7 +319,7 @@ Schedule a basic NGINX pod using the [kubectl run][kubectl-run] command in the *
292319
kubectl run nginx-dev --image=mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine --namespace dev
293320
```
294321

295-
As the sign in prompt, enter the credentials for your own `[email protected]` account created at the start of the article. Once you are successfully signed in, the account token is cached for future `kubectl` commands. The NGINX is successfully schedule, as shown in the following example output:
322+
As the sign-in prompt, enter the credentials for your own `[email protected]` account created at the start of the article. Once you are successfully signed in, the account token is cached for future `kubectl` commands. The NGINX is successfully schedule, as shown in the following example output:
296323

297324
```console
298325
$ kubectl run nginx-dev --image=mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine --namespace dev
@@ -435,3 +462,4 @@ For best practices on identity and resource control, see [Best practices for aut
435462
[az-ad-group-show]: /cli/azure/ad/group#az_ad_group_show
436463
[rbac-authorization]: concepts-identity.md#kubernetes-rbac
437464
[operator-best-practices-identity]: operator-best-practices-identity.md
465+
[terraform-on-azure]: /azure/developer/terraform/overview
96.5 KB
Loading

0 commit comments

Comments
 (0)