Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kubernetes-retired/dashboard/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Kubernetes Dashboard API uses Bearer token authentication to authenticate requests. The API acts as a proxy to the Kubernetes API server, forwarding authentication credentials to ensure proper authorization.Authentication Methods
Bearer Token Authentication
The primary authentication method is Bearer token authentication using Kubernetes service account tokens or OIDC tokens.Request Header
Example
Token Extraction
The API extracts Bearer tokens from theAuthorization header:
Token Validation
The Dashboard does not validate tokens directly. Instead, it forwards them to the Kubernetes API server, which performs validation and authorization.Client Initialization
The API supports two client modes:In-Cluster Client
Used for cluster-wide operations with the Dashboard’s service account:Per-Request Client
Created for each user request with their Bearer token:Authorization
RBAC Integration
The Dashboard respects Kubernetes RBAC policies. User permissions are determined by:- The service account associated with their token
- Roles and ClusterRoles bound to that service account
- RoleBindings and ClusterRoleBindings
Permission Checking
The API provides a permission checking endpoint:Check if the authenticated user has permission to perform an action
Request Body
Response
Self-Subject Access Review
The API uses KubernetesSelfSubjectAccessReview to check permissions:
Service Accounts
Dashboard Service Account
The Dashboard typically runs with its own service account:Creating User Service Accounts
Create a service account for API access:Extracting Service Account Token
Kubernetes 1.24+
Create a token manually:Kubernetes < 1.24
Extract from the secret:TLS/SSL Configuration
Certificate Management
The Dashboard API supports TLS with automatic certificate generation:Path to the TLS certificate file
Path to the TLS private key file
Enable automatic certificate generation using ECDSA P-256
Directory for auto-generated certificates
TLS Configuration
Minimum TLS version is set to TLS 1.2:API Server Connection
Configuration Options
The address of the Kubernetes API server (overrides in-cluster config)
Path to kubeconfig file (for out-of-cluster development)
Skip TLS verification for the API server connection
Path to custom CA bundle for API server verification
Connection Verification
On startup, the API verifies connectivity to the Kubernetes API server:Proxy Mode
For development, the Dashboard can run in proxy mode:Enable proxy mode (disables in-cluster client connections)
- In-cluster client is disabled
- All requests use per-request authentication
- Metrics integration is disabled
Security Headers
Authorization Header Handling
The API checks for the Authorization header:Setting Authorization Headers
For internal requests, the API sets authorization headers:Client Caching
The API supports client caching for improved performance:Enable client-side caching
User Agent
The Dashboard identifies itself to the API server:Error Responses
401 Unauthorized
Returned when no valid Bearer token is provided:403 Forbidden
Returned when the token is valid but lacks permissions:Example: Complete Authentication Flow
Step 1: Create Service Account
Step 2: Create Role Binding
Step 3: Get Token
Step 4: Make Authenticated Request
Response
Best Practices
Security Recommendations
- Use RBAC: Always use role-based access control with minimal required permissions
- Token Rotation: Regularly rotate service account tokens
- TLS Only: Always use HTTPS in production
- Token Scope: Create service accounts with specific namespace or resource access
- Avoid admin: Don’t bind service accounts to cluster-admin unless absolutely necessary