Interview Prep/Azure/AKS and Containers

You need to give a developer read-only kubectl access to one namespace.

BeginnerScenarioAKS and Containers
Answer

Situation read → With Azure RBAC enabled, assign a built-in role at namespace scope.

What I'd do →

  1. Assign the role:
    AKS_ID=$(az aks show -g rg -n aks --query id -o tsv)
    az role assignment create --assignee [email protected] \
      --role "Azure Kubernetes Service RBAC Reader" --scope "$AKS_ID/namespaces/shop"
    az role assignment create --assignee [email protected] \
      --role "Azure Kubernetes Service Cluster User Role" --scope "$AKS_ID"
    
  2. Developer runs az aks get-credentials and kubectl get pods -n shop
  3. Confirm kubectl get pods -n kube-system is forbidden

Why → The Cluster User role allows downloading kubeconfig; the RBAC Reader role defines what they can see.

Interview tip → Mention both roles; missing Cluster User Role is a common confusion.

Azure All Azure questions Roadmap: AKS & Azure DevOps

More on AKS and Containers