Build Authentik forward-auth primitive; gate Prometheus and Alertmanager (#137) - #180
Merged
Conversation
Domain-level Authentik proxy provider on the embedded outpost, gated on homelab-users, with a per-namespace Traefik forwardAuth middleware. First consumers are the Prometheus and Alertmanager UIs, which also get real externalUrls to close the dead alert-email-link gap (#117, #134). allowCrossNamespace stays off; the outpost-path route is co-located in the auth namespace so cross-namespace middleware trust is never needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds a reusable domain-level Authentik forward-auth primitive and uses it to expose the Prometheus and Alertmanager admin UIs behind SSO, fixing their dead
externalUrllinks.Refs #137, #117. Spec + plan in
docs/superpowers/.What's here
The primitive (defined once):
k8s/authentik/blueprints/applications/forward-auth.yaml— a proxy provider inforward_domainmode (cookie scoped tovigihome.net), assigned to the embedded outpost, gated onhomelab-users.k8s/authentik/ingress-forward-auth-outpost.yaml— the un-gated/outpost.goauthentik.iohandshake route, co-located in theauthnamespace so cross-namespace middleware trust is never needed.k8s/kube-prometheus-stack/middleware-forward-auth.yaml— themonitoring-namespaceforwardAuthmiddleware copy.First consumers (
k8s/kube-prometheus-stack/values.yaml):prometheus.vigihome.net/alertmanager.vigihome.net, gated by the middleware.externalUrls on both, replacing thehttp://localhost:9093placeholder so alert-notification email links resolve.Key decisions
homelab-users— gating a future no-auth service becomes one Ingress annotation.allowCrossNamespacestays OFF — the outpost route lives inauth, the middleware is copied per-namespace; no change to the Ansible-owned Traefik chart.strip-auth-headersmiddleware complements forward-auth (runs first → blanks client-spoofedX-authentik-*; forwardAuth re-injects authoritatively after).forward_domainmode, flow slugs, and theauthentik-serverService port 80 (not 9000) were all pinned against the live Authentik 2026.2.2.Flux tracks
main, so nothing is live until merge. After squash-merge, on the laptop:authentik-blueprintsConfigMap (kubectl create configmap … --from-file=… | apply),rollout restart deploy/authentik-worker, trigger discovery. Verify the embedded outpost shows the provider.flux reconcile kustomization authand… kps(or wait for the interval). Verifycurl https://prometheus.vigihome.net/outpost.goauthentik.io/ping→204.helm upgrade kps prometheus-community/kube-prometheus-stack --version 85.3.3 -n monitoring -f k8s/kube-prometheus-stack/values.yaml.Full steps in
docs/superpowers/plans/2026-06-26-forward-auth.md(Tasks 1–4 apply sections + Task 5).Acceptance matrix (run during cutover)
https://prometheus.vigihome.net→ 302 to Authentik; same for Alertmanager.homelab-usersmember → UI loads; non-member → 403.X-authentik-usernameheader → still 302 (no spoof bypass).kubectl -n monitoring port-forward svc/kps-kube-prometheus-stack-prometheus 9090:9090reaches the UI with Authentik out of the path.https://alertmanager.vigihome.netand resolves.Checklist
!Find/!KeyOfonly; no credentials in the repo.kubectl port-forward(bypasses Traefik/Authentik); no Bitwarden fallback credential applies. Documented ink8s/kube-prometheus-stack/README.md.