Feature: Expose the Longhorn UI at longhorn.<domain> behind basic auth #38

Merged
claude-bot Bot merged 1 commits from feature/longhorn-ui-ingress into main 2026-11-21 02:41:43 +01:00

Why

Until now the Longhorn UI was only reachable with kubectl port-forward. Longhorn has no login of its own and its UI can delete volumes, so it must not be exposed unprotected.

What

In 03-k8s-infra, next to the Longhorn Helm release:

  • Secret longhorn-ui-basic-auth (type kubernetes.io/basic-auth) holding the login
  • Traefik Middleware longhorn-ui-auth (basicAuth) that checks requests against that Secret
  • Ingress longhorn-ui for longhorn.<domain> → longhorn-frontend:80, with the middleware attached and a Let's Encrypt certificate from letsencrypt-prod

Follows Longhorn's Traefik guide (https://longhorn.io/docs/1.12.0/deploy/accessing-the-ui/longhorn-ingress-traefik/), plus TLS.

New config (03-k8s-infra)

  • domain (secret), same value as in k8s-apps
  • longhornUiUser, longhornUiPassword (secrets)

K8S_INFRA_PULUMI_DEV_YAML has already been updated in Gitea.

Deployment state

Already applied with a local pulumi up (3 created, 24 unchanged). The deploy on merge should show no changes. A DNS Resolver host override for longhorn.<domain> → Traefik VIP was added by hand in pfSense.

Verified

  • npm run typecheck passes
  • Certificate longhorn-ui-tls is Ready
  • curl https://longhorn.<domain>/ returns 401 with a valid certificate

Known limitation

Basic auth uses the browser's built-in prompt, so password managers can't save it reliably. A real login page (e.g. Authelia with forwardAuth) would replace only the Middleware spec.

## Why Until now the Longhorn UI was only reachable with `kubectl port-forward`. Longhorn has no login of its own and its UI can delete volumes, so it must not be exposed unprotected. ## What In `03-k8s-infra`, next to the Longhorn Helm release: - **Secret** `longhorn-ui-basic-auth` (type `kubernetes.io/basic-auth`) holding the login - **Traefik Middleware** `longhorn-ui-auth` (`basicAuth`) that checks requests against that Secret - **Ingress** `longhorn-ui` for `longhorn.<domain>` → `longhorn-frontend:80`, with the middleware attached and a Let's Encrypt certificate from `letsencrypt-prod` Follows Longhorn's Traefik guide (https://longhorn.io/docs/1.12.0/deploy/accessing-the-ui/longhorn-ingress-traefik/), plus TLS. ## New config (03-k8s-infra) - `domain` (secret), same value as in `k8s-apps` - `longhornUiUser`, `longhornUiPassword` (secrets) `K8S_INFRA_PULUMI_DEV_YAML` has already been updated in Gitea. ## Deployment state Already applied with a local `pulumi up` (3 created, 24 unchanged). The deploy on merge should show no changes. A DNS Resolver host override for `longhorn.<domain>` → Traefik VIP was added by hand in pfSense. ## Verified - `npm run typecheck` passes - Certificate `longhorn-ui-tls` is Ready - `curl https://longhorn.<domain>/` returns `401` with a valid certificate ## Known limitation Basic auth uses the browser's built-in prompt, so password managers can't save it reliably. A real login page (e.g. Authelia with `forwardAuth`) would replace only the Middleware spec.
claude-bot Bot added 1 commit 2026-11-21 02:27:45 +01:00
feature(k8s-infra): expose the Longhorn UI behind Traefik basic auth
Deploy k8s Infra / Pulumi Deploy (pull_request) Skipped
Deploy k8s Infra / Pulumi Preview (pull_request) Successful in 47s
020b277a04
The Longhorn UI has no login of its own and can delete volumes, so it is only reachable through a Traefik basicAuth middleware. Credentials come from the new longhornUiUser/longhornUiPassword config secrets; the hostname uses the new domain config.
claude-bot Bot merged commit 4b22f4ad11 into main 2026-11-21 02:41:43 +01:00
Sign in to join this conversation.