fix(ingress): let Traefik own HTTP-01 challenge path

This commit is contained in:
Hermes Agent
2026-11-22 21:15:20 +00:00
parent 1af4832e55
commit 8738e3c9d0
5 changed files with 11 additions and 72 deletions
@@ -32,9 +32,9 @@ WAN TCP 443 -> 192.168.1.114:443
Configure a Traefik `websecure` entrypoint on port `443` and use Traefik's
Let's Encrypt ACME resolver with the HTTP-01 challenge on the `web` entrypoint
(port `80`). Ordinary HTTP routes use a separate permanent `redirectScheme`
middleware on `web`; TLS routes are pinned to `websecure`. This keeps the
internal ACME challenge router separate from backend routes. Public Kubernetes
(port `80`). Ordinary HTTP requests use a permanent entrypoint redirect to
`websecure` with public port `443`; TLS routes are pinned to `websecure`. This
keeps the internal ACME challenge router separate from backend routes. Public Kubernetes
Ingress resources will opt into TLS using the same resolver.
The router must not terminate TLS, use a KeenDNS HTTPS proxy, rewrite SNI, or
+4 -5
View File
@@ -41,10 +41,9 @@ version. Inspect the live `HelmChart/traefik` values before applying a chart
override; do not assume that a values schema from another K3s release is
compatible.
For each public Ingress, pin the TLS route to `websecure`. The separate
`http-redirect.yaml` resource attaches a `redirectScheme` middleware to
`web`-only routes. Keeping the HTTP redirect separate prevents the internal
ACME challenge router from being sent to a backend.
For each public Ingress, pin the TLS route to `websecure`. Ordinary HTTP
requests are redirected by the Traefik `web` entrypoint to the public HTTPS
port `443`; no Kubernetes HTTP catch-all route is used.
The resulting TLS Ingress shape is:
@@ -73,7 +72,7 @@ installed K3s `HelmChart/traefik` with:
- `web` exposed on TCP `80` for the HTTP redirect and ACME HTTP-01;
- `websecure` exposed on TCP `443` for TLS termination;
- a permanent HTTP-to-HTTPS `redirectScheme` middleware on web-only routes;
- a permanent HTTP-to-HTTPS entrypoint redirect with public port `443`;
- the `letsencrypt` ACME resolver using HTTP-01 through `web` (Traefik's
ACME challenge handling remains available on the `web` entrypoint);
- persistent `/data/acme.json` storage through a `1Gi` PVC.
@@ -1,63 +0,0 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: http-to-https
namespace: hermes
spec:
redirectScheme:
scheme: https
permanent: true
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: http-redirect
namespace: hermes
labels:
app.kubernetes.io/name: http-redirect
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
traefik.ingress.kubernetes.io/router.middlewares: hermes-http-to-https@kubernetescrd
spec:
ingressClassName: traefik
rules:
- host: hermes.rudolf.keenetic.link
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hermes
port:
name: dashboard
- host: brencher.rudolf.keenetic.link
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: brencher-swarm
port:
name: http
- host: immich.rudolf.keenetic.link
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: immich-swarm
port:
name: http
- host: gitea.rudolf.keenetic.link
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gitea-swarm
port:
name: http
@@ -3,5 +3,4 @@ kind: Kustomization
resources:
- swarm-backends.yaml
- traefik-https-config.yaml
- http-redirect.yaml
- public-ingress.yaml
@@ -25,6 +25,10 @@ spec:
additionalArguments:
- "--entrypoints.web.address=:8000/tcp"
- "--entrypoints.websecure.address=:8443/tcp"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.web.http.redirections.entrypoint.port=443"
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
- "--certificatesresolvers.letsencrypt.acme.email=rudolfss13@gmail.com"
- "--certificatesresolvers.letsencrypt.acme.storage=/data/acme.json"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"