Secure Kubernetes Dashboard with Authelia forward_auth #29

Open
opened 2026-07-25 19:37:16 +00:00 by lab · 0 comments
Owner

The Kubernetes Dashboard is exposed via LoadBalancer (192.168.0.209) but has no authentication layer in Caddy. The bearer token is the only barrier.

Solution

Add a Caddy route with forward_auth pointing to Authelia, so users must authenticate before accessing the dashboard.

Steps

  1. Add to caddy/configmap.yaml:
k8s.yukselcloud.com {
    log
    crowdsec
    forward_auth authelia.auth.svc.cluster.local:9091 {
        uri /api/authz/forward-auth
        copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
    }
    reverse_proxy kubernetes-dashboard.kubernetes-dashboard.svc.cluster.local:443 {
        header_up Host {host}
        header_up X-Forwarded-Proto https
    }
}
  1. Apply configmap and restart Caddy
  2. Add DNS record in DDNS config
  3. Optionally change dashboard service to ClusterIP (no need for direct LB access)
The Kubernetes Dashboard is exposed via LoadBalancer (192.168.0.209) but has no authentication layer in Caddy. The bearer token is the only barrier. ## Solution Add a Caddy route with `forward_auth` pointing to Authelia, so users must authenticate before accessing the dashboard. ## Steps 1. Add to `caddy/configmap.yaml`: ```caddyfile k8s.yukselcloud.com { log crowdsec forward_auth authelia.auth.svc.cluster.local:9091 { uri /api/authz/forward-auth copy_headers Remote-User Remote-Groups Remote-Name Remote-Email } reverse_proxy kubernetes-dashboard.kubernetes-dashboard.svc.cluster.local:443 { header_up Host {host} header_up X-Forwarded-Proto https } } ``` 2. Apply configmap and restart Caddy 3. Add DNS record in DDNS config 4. Optionally change dashboard service to ClusterIP (no need for direct LB access)
lab added this to the Security Hardening milestone 2026-07-25 19:37:16 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lab/homelab#29
No description provided.