AKS icon indicating copy to clipboard operation
AKS copied to clipboard

az aks browse kubernetes dashboard doesn't work anymore

Open Doubleth1nk opened this issue 8 years ago • 10 comments

What happened: after creating aks service i get the following errors when using the kubernetes dashboard (az aks browse --name xxx --resource-group xxx). This happens with version 1.11.1. Last time this worked was version 1.9.6)

warning configmaps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list configmaps in the namespace "default" close warning persistentvolumeclaims is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list persistentvolumeclaims in the namespace "default" close warning secrets is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list secrets in the namespace "default" close warning services is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list services in the namespace "default" close warning ingresses.extensions is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list ingresses.extensions in the namespace "default" close warning daemonsets.apps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list daemonsets.apps in the namespace "default" close warning pods is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list pods in the namespace "default" close warning events is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list events in the namespace "default" close warning deployments.apps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list deployments.apps in the namespace "default" close warning replicasets.apps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list replicasets.apps in the namespace "default" close warning jobs.batch is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list jobs.batch in the namespace "default" close warning cronjobs.batch is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list cronjobs.batch in the namespace "default" close warning replicationcontrollers is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list replicationcontrollers in the namespace "default" close warning statefulsets.apps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list statefulsets.apps in the namespace "default"

What you expected to happen: an kubernetes interface without errors

How to reproduce it (as minimally and precisely as possible): in ubuntu 18.04 (also seen this issue on mac) azure-cli (2.0.43). Create kubernetes service: az aks create --resource-group xxx --name xxx --node-count 3 --generate-ssh-keys --kubernetes-version 1.11.1 Then use kubernetes dashboard: az aks browse --name xxx --resource-group xxx and see the errors.

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version): Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.4", GitCommit:"5ca598b4ba5abb89bb773071ce452e33fb66339d", GitTreeState:"clean", BuildDate:"2018-06-06T08:13:03Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:43:26Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

  • Size of cluster (how many worker nodes are in the cluster?): 3

  • General description of workloads in the cluster (e.g. HTTP microservices, Java app, Ruby on Rails, machine learning, etc.) : Just testing the kubernetes dashboard.

  • Others:

Doubleth1nk avatar Aug 13 '18 14:08 Doubleth1nk

Rbac is enabled by default now. You have to create a dashboard user and use it to login. (You have to browse to /login manually too).

Just an example one I use....

kubectl apply this

apiVersion: v1
kind: ServiceAccount
metadata:
  name: aks-dashboard-admin
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: aks-dashboard-admin
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: aks-dashboard-admin
  namespace: kube-system

Then in powershell to get the token for login.

$data = kubectl get secret --namespace=kube-system $(kubectl get serviceaccount --namespace=kube-system aks-dashboard-admin -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}"
[System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($data))

Then you go to http://127.0.0.1:8001/#!/login manually once you start az browse and paste in the token.

marekr avatar Aug 13 '18 15:08 marekr

Instructions are here. We are working on adding this to the formal documentation.

cc: @sauryadas @iainfoulds

seanmck avatar Aug 14 '18 06:08 seanmck

Updated documentation is available here: https://docs.microsoft.com/en-us/azure/aks/kubernetes-dashboard

MaurGi avatar Nov 09 '18 16:11 MaurGi

If you aren't keen on doling out cluster-admin, create your own clusterrole, or use the view clusterrole; this allows dashboard users to view every resource except for secrets and cluster-wide resources (nodes, PVCs, roles), and prevents changes via the dashboard.

The cluster role binding manifest for view:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: kubernetes-dashboard-viewer
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: view
subjects:
- kind: ServiceAccount
  name: kubernetes-dashboard
  namespace: kube-system

scottzilla avatar Jan 29 '19 17:01 scottzilla

I faced same issue. You need to run this command kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

sshakhtour avatar Jun 27 '19 15:06 sshakhtour

@sshakhtour i have it already running but still can't see the issue.

vagrant@k8s-master:~$ kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
Error from server (AlreadyExists): clusterrolebindings.rbac.authorization.k8s.io "kubernetes-dashboard" already exists
vagrant@k8s-master:~$

You have an idea about what should i do?

soufiane-fadil avatar Sep 26 '19 09:09 soufiane-fadil

I run into this as well i simply had to delete the ClusterRoleBinding: kubectl delete ClusterRoleBinding kubernetes-dashboard

and then I recreated it kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

rventuri76 avatar Nov 08 '19 22:11 rventuri76

I run into this as well i simply had to delete the ClusterRoleBinding: kubectl delete ClusterRoleBinding kubernetes-dashboard

and then I recreated it kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

Thanks a lot! It worked for me

SambhavSacheti avatar Dec 15 '19 16:12 SambhavSacheti

kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

This command is worked for me. After this we should browse aks again to connect.

Leoxe avatar Mar 19 '20 06:03 Leoxe

Getting the same error, "Already exists".

Commands did not work for me. Still getting many dashboard errors.

mnns avatar Apr 29 '20 21:04 mnns