0
votes

I have deployed Kubernetes Dashboard v2.0.4 using Helm on my Azure Kubernetes Service cluster. For some reason I don't have the user icon on the top right of the page and I'm automatically login to the dashboard with minimal access.

I can give myself admin access by creating a clusterRoleBinding between the serviceAccount created during the dashboard installation and the cluster-admin role but I want to be able to provide a token without having to bind it directly to the dashboard's serviceAccount.

Here's a screenshot from Azure's Kubernetes Dashboad add-on where you can see the user icon I'm talking about: Azure's Kubernetes Dashboad add-on

Here's a screenshot from my dashboard where there isn't a user icon: My dashboard page

Here's the Helm command I used to install the dashboard:

helm install my-dashboard k8s-dashboard/kubernetes-dashboard --version 3.0.0 --set=service.externalPort=80 --set=protocolHttp=true --set=metricsScraper.enabled=true -n my-namespace

I'm also using nginx ingress to access to the dashboard.

I don't know if I mistakenly changed a configuration somewhere to bind the cluster-admin role token permanently to the dashboard's service account but after deleting and re-installing the Helm chart, I'm still not able to logout and provide a token.

Any idea why this occurs?

Thanks

1

1 Answers

0
votes

I would say you from the begging - I havent reproduced you question - answering based on my prev knowledge.

Can you please specify exact repo you used for kubernetes-dashboard installation?

The proper ways of accessing dashboard via bearer token are

  • grant cluster-admin role to dashboard servicaccount

or

  • you can create separate cluster admin account if you dont want to grant the access to default one
---#create SA
$ kubectl create serviceaccount cluster-admin-dashboard-sa
$ kubectl create clusterrolebinding cluster-admin-dashboard-sa \
  --clusterrole=cluster-admin \
  --serviceaccount=default:cluster-admin-dashboard-sa

---#retrieve token
$ kubectl get secret | grep cluster-admin-dashboard-sa
cluster-admin-dashboard-sa-token-6xm8l   kubernetes.io/service-account-token   3         18m
$ kubectl describe secret cluster-admin-dashboard-sa-token-6xm8l

Above approach is not counted as secure one, so please consider using other available authentication methods while work with production servers.

Use the AKS Kubernetes dashboard also shows you the way to set up and configure kubernetes dashboard.

Also few tips.

  • I always use latest kubernetes/dashboard documentation and steps for GCP dashboards. There is no helm there, you simply install with kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.4/aio/deploy/recommended.yaml and accessing using Authentication Token

  • talking about Azure - I prefer to start dashboard using provided command in doc az aks browse --resource-group yourResourceGroup --name yourCluster

Clear all cache after redeploying before accessing dashboard. Also check if helm wipes all prev resources upon deletion/re-installation.

If that doesnt work - can you try to access dashboard using kubeconfig(modified for your newly created user)