Skip to main content
Kubernetes Dashboard provides multiple layers of security configuration including RBAC, network policies, pod security contexts, and CSRF protection.

Security Context

Pod and container security contexts enforce security policies at the runtime level.

Pod Security Context

object
Security context applied to all Dashboard pods.
Default configuration:
  • runAsNonRoot: true - Prevents running as root user
  • seccompProfile.type: RuntimeDefault - Uses the default seccomp profile
To disable, set to null:

Container Security Context

object
Security context applied to all Dashboard containers.
Default configuration:
  • allowPrivilegeEscalation: false - Prevents privilege escalation
  • readOnlyRootFilesystem: true - Root filesystem is read-only
  • runAsUser: 1001 - Runs as non-root user ID 1001
  • runAsGroup: 2001 - Runs as group ID 2001
  • capabilities.drop: ["ALL"] - Drops all Linux capabilities
To disable, set to null:

CSRF Protection

Cross-Site Request Forgery (CSRF) protection is enabled by default for API and Auth modules.
string
default:"null"
Base64 encoded random 256 bytes string used for CSRF protection.
If empty (default): A random key is auto-generated and stored in a Secret.If provided: The specified key is used. This is useful for:
  • Maintaining sessions across pod restarts
  • Sharing keys across multiple Dashboard instances
Generate a secure key:
The CSRF key is automatically injected into API and Auth containers via the CSRF_KEY environment variable.
Never commit CSRF keys to version control. Use Kubernetes Secrets or external secret management solutions.

Network Policy

Network policies control network traffic to and from Dashboard pods.
boolean
default:"false"
Enable NetworkPolicy resource creation.
Requires a CNI plugin that supports NetworkPolicy (e.g., Calico, Cilium, Weave Net).
boolean
default:"false"
Deny all ingress traffic (useful for complete lockdown).
When true, creates an empty ingress rule that blocks all traffic.
object
default:"{}"
Raw NetworkPolicy spec that overrides the predefined configuration.

Default Network Policy Behavior

When enabled: true and ingressDenyAll: false (and no custom spec), the default policy allows:
This allows ingress on web and api ports from any source.

Pod Disruption Budget

Pod Disruption Budgets (PDB) ensure availability during voluntary disruptions.
boolean
default:"false"
Enable PodDisruptionBudget creation.
See Kubernetes PDB documentation.
number
default:"0"
Minimum number of pods that must remain available during disruptions.
Cannot be used together with maxUnavailable.
number
default:"0"
Maximum number of pods that can be unavailable during disruptions.
Cannot be used together with minAvailable.

RBAC Configuration

Dashboard creates minimal RBAC resources by default. Each module has its own ServiceAccount.

API Module RBAC

The API module requires permissions to proxy requests to the metrics-scraper service. ServiceAccount: kubernetes-dashboard-api Role (namespace-scoped):

Metrics Scraper RBAC

The metrics scraper requires cluster-wide read access to pod and node metrics. ServiceAccount: kubernetes-dashboard-metrics-scraper ClusterRole:

Web Module RBAC

ServiceAccount: kubernetes-dashboard-web Role: Minimal permissions (similar to API module).

Auth Module

The Auth module uses the default service account and doesn’t require special RBAC permissions.
Dashboard does NOT create ClusterRoleBindings that grant admin access. Users authenticate with their own credentials and Dashboard impersonates their permissions.

TLS Configuration

Dashboard uses TLS for secure communication. TLS is handled by the Kong gateway.

Certificate Management

When using cert-manager with Ingress:
See Ingress Configuration for details.

API Server TLS Verification

By default, Dashboard verifies the Kubernetes API server’s TLS certificate. To skip verification (not recommended for production):

Custom CA Bundle

If your API server uses a custom CA:

Example Security Configurations

High Security Production Setup

Restrictive Network Policy

Minimal RBAC with User Permissions

Dashboard relies on user authentication and impersonation. To grant users access:
Users will only see resources they have permissions for.

Security Best Practices

  1. Always use HTTPS: Enable TLS on Ingress
  2. Enable Network Policies: Restrict traffic to/from Dashboard
  3. Use Pod Disruption Budgets: Ensure availability with multiple replicas
  4. Never disable CSRF protection in production
  5. Use read-only root filesystem: Already enabled by default
  6. Drop all capabilities: Already configured by default
  7. Run as non-root: Already configured by default
  8. Verify API server certificates: Don’t use --apiserver-skip-tls-verify in production
  9. Use external secret management: For CSRF keys and sensitive data
  10. Grant minimal RBAC permissions: Users should only have access to what they need