Hey everyone! I recently ran into a funny (and a bit frustrating) problem when learning Kubernetes on Minikube:
The namespace I created (nginx) wasn’t appearing in the Kubernetes Dashboard, even though it clearly existed when I checked in the terminal!
If you’re a dev or student starting with Kubernetes and the Dashboard, this walkthrough is for you.
The Problem: Namespace Not Visible in Dashboard
I was following tutorials and had all my deployments, pods, and services running in a namespace called nginx
.
When I ran in the terminal:
kubectl get namespaces
I saw nginx
listed, and:
kubectl get all -n nginx
showed all my resources.
BUT – when I opened the Kubernetes Dashboard, the namespace selector did not list nginx
at all! I couldn't see or interact with any of my workflows from the web UI.
What I Tried (and Didn’t Work)
- Refreshing the Dashboard page 🔄
- Closing and reopening my browser
- Restarting minikube
Nothing helped.
So, what gives??
The Solution: It’s All About Dashboard Permissions (RBAC!)
It turns out, the Dashboard runs as a user with limited permissions by default.
If that user doesn’t have rights to see all namespaces, they simply don’t show up in the UI, even if they exist!
Here’s How I Fixed It:
- Create an Admin Account for the Dashboard
Save the following YAML as dashboard-adminuser.yaml
:
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
- Apply the Admin Account
kubectl apply -f dashboard-adminuser.yaml
- Get the Login Token
kubectl -n kubernetes-dashboard create token admin-user
(If your version doesn’t support create token
, use describe secret
as shown in the Dashboard docs.)
- Login With This Token in the Dashboard
Go to the Kubernetes Dashboard login screen, paste the token, and…
️🎉 Now all namespaces (including nginx
) appear in the selector!
Why Does This Happen?
The dashboard only lists namespaces your account can see. If it runs with minimal permissions, “hidden” namespaces simply won’t be listed.
TL;DR for New Kubernetes Users
- If your namespace shows up in
kubectl
but NOT in the dashboard, it’s (almost always) a permissions issue. - Fix it by creating a service account with cluster-admin rights for learning/dev.
- Use the token login in your dashboard.
- Don’t forget: RBAC controls rule everything in Kubernetes.
Hope this saves you from an afternoon of confusion like mine!
If you hit other beginner Kubernetes mysteries — drop them in the comments or ask away.
Happy DevOps! 🚢