How to enable user to access AKS workloads via Azure portal with Reader subscription

Li Jun - Hanson 1 Reputation point
2021-03-31T03:57:19.953+00:00

We have read access subscription, and user can not access some resources in AKS like workloads, namespaces etc.
How can we enable user to access AKS resources via Azure portal with Reader subscription?

The ways I've tried is to use AKS-managed AD and K8S RBAC, the specific namespace resource can be accessed by kubectl, but still can not be accessed via portal. Is it a bug?

83056-image.png

83038-image.png

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,852 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. shiva patpi 13,131 Reputation points Microsoft Employee
    2021-04-01T01:08:58.463+00:00

    Hello @Li Jun - Hanson ,
    Thanks for your query !

    Can you try out the below steps:
     
      1) Connect to the cluster using –admin flag
            az aks get-credentials -g rgname -n aksclustername --admin

      2) Get the user name UPN for which you want to provide the access using the below command
           az ad signed-in-user show --query userPrincipalName -o tsv

      3) Using the below document

    • https://learn.microsoft.com/en-us/azure/aks/azure-ad-integration-cli#create-kubernetes-rbac-binding     Create YAML file of Kind: ClusterRoleBinding
       
       
      Sample clusterrole.yaml YAML FILE:
       
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRoleBinding
      metadata:
        name: cluster-admin
      roleRef:
        apiGroup: rbac.authorization.k8s.io
        kind: ClusterRole
        name: cluster-admin
      subjects:
      • apiGroup: rbac.authorization.k8s.io
          kind: User
          name: UPN of the user from above command
         
         
        4) kubectl apply -f C:\clusterrole.yml

    Hope above steps helps out in resolving the issue , kindly make sure to "Upvote and Accept the answer"


  2. Mukul Bana 6 Reputation points
    2021-04-01T14:28:12.307+00:00

    Hi @Li Jun - Hanson ,

    If you have "reader" access of the subscription and not able to view resources/components of AKS there could be attributed to either for the scenario below -

    1. You're running a private AKS Cluster?
    2. You've allowed whitelisted certain IP-addresses for API server?
    0 comments No comments