Not able to browse Kubernetes dashboard for clusters created in Azure

7/16/2020

Trying to access Kubernetes dashboard (Azure AKS) by using below command but getting error as attached.

az aks browse --resource-group rg-name --name aks-cluster-name --listen-port 8851

Kubernetes dashboard browing error

-- Chaitanya
azure-aks
kubernetes
kubernetes-dashboard

2 Answers

7/16/2020

Try to run this

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}').

You will get many values for some other keys such as Name, Labels, ..., token . The important one is the token that related to your name. Then copy that token and paste it.

-- Dashrath Mundkar
Source: StackOverflow

7/16/2020

Please read AKS documentation of how to authenticate the dashboard from link. This also explains about how to enable the addon for newer version of k8s also.

Pasting here for reference

Use a kubeconfig

For both Azure AD enabled and non-Azure AD enabled clusters, a kubeconfig can be passed in. Ensure access tokens are valid, if your tokens are expired you can refresh tokens via kubectl.

  1. Set the admin kubeconfig with az aks get-credentials -a --resource-group <RG_NAME> --name <CLUSTER_NAME>
  2. Select Kubeconfig and click Choose kubeconfig file to open file selector
  3. Select your kubeconfig file (defaults to $HOME/.kube/config)
  4. Click Sign In

Use a token

  1. For non-Azure AD enabled cluster, run kubectl config view and copy the token associated with the user account of your cluster.
  2. Paste into the token option at sign in.
  3. Click Sign In

For Azure AD enabled clusters, retrieve your AAD token with the following command. Validate you've replaced the resource group and cluster name in the command.

kubectl config view -o jsonpath='{.users[?(@.name == "clusterUser_<RESOURCE GROUP>_<AKS_NAME>")].user.auth-provider.config.access-token}'
-- Atul
Source: StackOverflow