Installing kubernetes-dashboard with helm fails

10/24/2019

I've just created a new kubernetes cluster. The only thing I have done beyond set up the cluster is install Tiller using helm init and install kubernetes dashboard through helm install stable/kubernetes-dashboard.

The helm install command seems to be successful and helm ls outputs:

NAME                    REVISION        UPDATED                         STATUS          CHART                           APP VERSION     NAMESPACE
exhaling-ladybug        1               Thu Oct 24 16:56:49 2019        DEPLOYED        kubernetes-dashboard-1.10.0     1.10.1          default  

However after waiting a few minutes the deployment is still not ready.

Running kubectl get pods shows that the pod's status as CrashLoopBackOff.

NAME                                    READY   STATUS             RESTARTS   AGE
exhaling-ladybug-kubernetes-dashboard   0/1     CrashLoopBackOff   10         31m

The description for the pod shows the following events:

Events:
  Type     Reason     Age                   From                 Message
  ----     ------     ----                  ----                 -------
  Normal   Scheduled  31m                   default-scheduler    Successfully assigned default/exhaling-ladybug-kubernetes-dashboard to nodes-1
  Normal   Pulling    31m                   kubelet, nodes-1     Pulling image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1"
  Normal   Pulled     31m                   kubelet, nodes-1     Successfully pulled image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1"
  Normal   Started    30m (x4 over 31m)     kubelet, nodes-1     Started container kubernetes-dashboard
  Normal   Pulled     30m (x4 over 31m)     kubelet, nodes-1     Container image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1" already present on machine
  Normal   Created    30m (x5 over 31m)     kubelet, nodes-1     Created container kubernetes-dashboard
  Warning  BackOff    107s (x141 over 31m)  kubelet, nodes-1     Back-off restarting failed container

And the logs show the following panic message

panic: secrets is forbidden: User "system:serviceaccount:default:exhaling-ladybug-kubernetes-dashboard" cannot create resource "secrets" in API group "" in the namespace "kube-system"

Am I doing something wrong? Why is it trying to create a secret somewhere it cannot?

Is it possible to setup without giving the dashboard account cluster-admin permissions?

-- Increasingly Idiotic
kubernetes
kubernetes-dashboard
kubernetes-helm

4 Answers

10/25/2019

Try creating clusterrole

kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
-- Harsh Manvar
Source: StackOverflow

10/25/2019

By default i have puted namespace equals default, but if is other you need to replace for yours

kubectl create serviceaccount exhaling-ladybug-kubernetes-dashboard
kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=default:exhaling-ladybug-kubernetes-dashboard
-- Lucas Serra
Source: StackOverflow

1/7/2020

based on the error you have posted what is happineening is:
1. helm is trying is install dashboard but by default it was picking up the namespace you have provided.

For solving that:
1. either you create roles based on the namespace you are trying to install, by default namespace should be: default
2. just install the helm chart in the proper location which is required by helm chart, in your case you can do:

helm install stable/kubernetes-dashboard --name=kubernetes-dashboard --namespace=kube-system
-- anand
Source: StackOverflow

11/2/2019

Check this out mate:

https://akomljen.com/installing-kubernetes-dashboard-per-namespace/

You can create your own roles if you want to.

-- Celso Jr
Source: StackOverflow