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

Scenario

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

If so, this means you installed kubernetes dashboard and you are facing this issue.

This means, you are step ahead celebrating the k8s dashboard and show it to your Boss.

But this error lets you angry

Solution

Using Helm

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

rbac:  clusterReadOnlyRole: true  clusterAdminRole: false

If you want to grant wider access, switch the “true” and “false“.

Without Helm

You are a poor man. How come you install apps on top of k8s without Helm ?

  • Install Helm
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
  • Install k8s dashboard with Helm
helm install k8s-dashboard stable/kubernetes-dashboard \
-n kube-system \
-f values.yaml

Content of values.yaml explained above.

Related:

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

DevOps lifecycle; CI/CD with Jenkins(Intro)

Leftmost Column with at Least a One Problem — Leetcode

Chrome 80 and crosssite coockie

An Introduction to Blockchain Technology and Implementation Using Python

A guide to Ruby’s yield keyword when you’re feeling lost

Convert ipynb to .py

#FirstSteps: Basic Git Commands — You will use on daily or hourly basis.

Top 3 VSCode Extensions -Updated List

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
Abdennour Toumi

Abdennour Toumi

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

More from Medium

GitOps With Flux (Complete Setup Guide)

A Guide to Secrets Management with GitOps and Kubernetes

Secure your k8s cluster with Falco

How to Improve the Security of Your Applications with Kubernetes Security Scanners