namespaces is forbidden: User “system:serviceaccount:kube-system:kubernetes-dashboard” cannot list resource “namespaces” in API group “” at the cluster scope

Image for post
Image for post

Scenario

Probably, you are here because you have the same error in the screenshot above.

Solution

Using Helm

If you installed the dashboard with Helm, you just need to add these values :

rbac:  clusterReadOnlyRole: true  clusterAdminRole: false
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
helm install k8s-dashboard stable/kubernetes-dashboard \
-n kube-system \
-f values.yaml

Related:

Written by

Software engineer, Cloud Architect, 5/5 AWS|GCP|PSM Certified, Owner of kubernetes.tn

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store