1) How many ServiceAccounts exist in the default namespace?
Run:
default namespace: default and dev.
2) What Secret token is used by the default ServiceAccount?
Describe the default ServiceAccount:
Tokens section. In this environment the default ServiceAccount shows:
default ServiceAccount currently has no token listed (or none is shown).
3) Inspect the dashboard Deployment — what image does it use?
List Deployments and describe theweb-dashboard Deployment:
Containers, the image is:
web-dashboard deployment.
4) When accessing the dashboard UI, an error appears: what does it mean?
When trying to list Pods from the dashboard UI, you may see an error like:default ServiceAccount (system:serviceaccount:default:default) and that ServiceAccount does not have RBAC permission to list Pods in the default namespace. In short: the dashboard is running under a ServiceAccount with insufficient privileges.
5) Which ServiceAccount is mounted to the dashboard Pod, and where are its credentials located?
Get the Pod name and describe it:Service Account field and the Mounts section. Example relevant parts:
- The Pod is using the
defaultServiceAccount. - The ServiceAccount credentials (token, CA certificate, and namespace file) are projected into the Pod at
/var/run/secrets/kubernetes.io/serviceaccount.
Volumes section you will often see the projected token details such as:
6) Create a new ServiceAccount for the dashboard: dashboard-sa
Create the ServiceAccount:
/var/rbac/:
Service account tokens are sensitive credentials. Do not share them, and never commit them into source control.
dashboard-sa has the correct RBAC Role or RoleBinding applied in the environment.
Grant only the minimum permissions required to ServiceAccounts. Avoid binding overly broad roles such as
cluster-admin unless absolutely necessary.7) Configure the web-dashboard Deployment to use dashboard-sa automatically
Instead of manually pasting a token into the UI, update the Deployment so Pods automatically receive the dashboard-sa token. Add serviceAccountName: dashboard-sa under spec.template.spec in the Deployment manifest.
- Export the existing Deployment to YAML:
- Edit
dashboard.yaml. Underspec.template.specadd theserviceAccountNamefield. Example snippet showing where to add it:
- Apply the updated Deployment:
dashboard-sa token automatically at /var/run/secrets/kubernetes.io/serviceaccount, the dashboard will authenticate as system:serviceaccount:default:dashboard-sa and should be able to list Pods if RBAC permits.
Quick reference — common commands
Summary
- The dashboard was running with the
defaultServiceAccount, which lacked permission to list Pods. - You created
dashboard-sa, generated a token to test permissions, and then updated the Deployment to useserviceAccountName: dashboard-sa. Future Pods will automatically mount the correct token and use the intended RBAC identity.
- Kubernetes Service Accounts
- Kubernetes RBAC Authorization
- Kubernetes Secrets and Service Account tokens