Overview
Kubernetes Dashboard acts as a proxy and passes all authentication information to the Kubernetes API server. Authorization is handled by Kubernetes itself, and Dashboard displays appropriate warnings if access is forbidden.Authentication is required to access Dashboard when deployed with the default configuration. The login view is enabled by default and exposed via the gateway.
Authentication Methods
Dashboard supports two primary authentication methods:Bearer Token
The recommended method for authenticating with Dashboard. Every Kubernetes Service Account has a Secret with a valid Bearer Token that can be used for login. Creating a token:Authorization Header
For advanced use cases, you can pass an authorization header with every request:- Configuring a reverse proxy in front of Dashboard
- Integrating with external identity providers
- Implementing custom authentication flows
Creating a Service Account
To create a user with admin permissions:Step 1: Create Service Account
Create a file nameddashboard-adminuser.yaml:
Step 2: Create ClusterRoleBinding
Grant cluster-admin privileges to the service account:Step 3: Get Bearer Token
Generate a token for the service account:Login Process
The Dashboard authentication flow (modules/auth/pkg/routes/login/login.go:25-39):
1
Navigate to Dashboard
Open the Dashboard URL in your browser. You’ll see the login screen.
2
Enter Token
Paste your bearer token into the “Enter token” field.
3
Sign In
Click “Sign in” to authenticate. Dashboard validates the token against the Kubernetes API server.
Default Permissions
Dashboard components have minimal default privileges:Web Container
getandupdatepermissions for the settings ConfigMap- Default ConfigMap name:
kubernetes-dashboard-settings - Default namespace:
kubernetes-dashboard
API Container
getpermission forservices/proxyto gather metrics- Default service:
kubernetes-dashboard-metrics-scraper
Metrics Scraper
get,list,watchpermissions formetrics.k8s.ioAPI
RBAC Configuration
For fine-grained access control, use Kubernetes RBAC: Learn more about Kubernetes RBAC:Cleanup
To remove the admin service account:Troubleshooting
Token login fails with 'invalid token' error
Token login fails with 'invalid token' error
Ensure you’re accessing Dashboard over HTTPS. Token login is not allowed over HTTP connections.
Access denied after successful login
Access denied after successful login
Check the RBAC permissions for your service account. The account needs appropriate ClusterRole or Role bindings.