<p>When running the Kubernetes Dashboard in a Windows Docker Desktop when I click on &quot;pods&quot; either nothing is shown</p>
<blockquote>
<p>There is nothing to display here No resources found.</p>
</blockquote>
<p>or I get this error:</p>
<blockquote>
<p>deployments.apps is forbidden: User
&quot;system:serviceaccount:kubernetes-dashboard:kubernetes-dashboard&quot;
cannot list resource &quot;deployments&quot; in API group &quot;apps&quot; in the
namespace &quot;default&quot;</p>
</blockquote>
<p>Was there anything running? Yes.</p>
<p><a href="https://i.stack.imgur.com/GAgsW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GAgsW.png" alt="enter image description here" /></a></p>
<blockquote>
<p><strong>How can I get an overview of my pods?</strong></p>
</blockquote>
<p>What's the config? In the Windows Docker Desktop environment, I stared with a fresh Kubernetes. I removed any old user &quot;./kube/config&quot; file.</p>
<p>To get the Kubernetes dashboard runnig, I did the procedure:</p>
<ol>
<li><p>Get the dashboard: kubectl apply -f <a href="https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml" rel="nofollow noreferrer">https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml</a></p>
</li>
<li><p>Because generating tokens via a standard procedure (as found on many places) did not work, I took the alternative short-cut:</p>
</li>
</ol>
<p>kubectl patch deployment kubernetes-dashboard -n kubernetes-dashboard --type 'json' -p '[{&quot;op&quot;: &quot;add&quot;, &quot;path&quot;: &quot;/spec/template/spec/containers/0/args/-&quot;, &quot;value&quot;: &quot;--enable-skip-login&quot;}]'</p>
<ol start="3">
<li><p>After typing &quot;kubectl proxy&quot; the result is: Starting to serve on 127.0.0.1:8001</p>
</li>
<li><p>In a browser I started the dashboard:
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/workloads?namespace=default</p>
</li>
</ol>
<p>After clicking the &quot;Skip&quot; button, the dashboard opened.</p>
<p>Clicking on &quot;Pods&quot; (and nearly all other items) gave this error:</p>
<blockquote>
<p>pods is forbidden: User
&quot;system:serviceaccount:kubernetes-dashboard:kubernetes-dashboard&quot;
cannot list resource &quot;pods&quot; in API group &quot;&quot; in the namespace
&quot;kubernetes-dashboard&quot;  (could be &quot;default&quot; as well)</p>
</blockquote>
<p>It did not matter whether I chose the default namespace.</p>
<p><strong>ALTERNATIVE:</strong> As an alternative I tried to bind the kubernetes-dashboard ServiceAccount to the cluster-admin ClusterRole.</p>
<ol>
<li>Preparations: create this file:</li>
</ol>
<blockquote>
<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
</code></pre>
</blockquote>
<pre><code>$ kubectl apply -f s.yml
</code></pre>
<p>Create this file:</p>
<blockquote>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
</code></pre>
</blockquote>
<pre><code>$ kubectl apply -f r.yml
</code></pre>
<p>Then run this command:</p>
<pre><code>$ kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath=&quot;{.secrets[0].name}&quot;) -o go-template=&quot;{{.data.token | base64decode}}&quot;
</code></pre>
<p>This (or similar alternative) command gives a lot of errors.</p>
<p>Breaking this command down in parts: kubectl -n kubernetes-dashboard get sa/admin-user ... gives:</p>
<p><a href="https://i.stack.imgur.com/35VdV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/35VdV.png" alt="enter image description here" /></a></p>
<p>This command: kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath=&quot;{.secrets[0].name}&quot; gives no result.</p>

tm1701
<p>It's definitely a Permissions issue.</p>
<p>Binds the kubernetes-dashboard ServiceAccount to the cluster-admin ClusterRole.</p>
<p>Otherwise it doesn't have the privileges to be able to collect data from the cluster.</p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: dashboard-admin
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: kubernetes-dashboard
  namespace: NAMESPACE-WHERE-DASHBOARD-IS
</code></pre>
