diff --git a/docs/decisions/2026-11-21-traefik-tls-http01.md b/docs/decisions/2026-11-21-traefik-tls-http01.md index 9542c3c..188c0ee 100644 --- a/docs/decisions/2026-11-21-traefik-tls-http01.md +++ b/docs/decisions/2026-11-21-traefik-tls-http01.md @@ -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 diff --git a/k3s_rencher/infrastructure/ingress/README.md b/k3s_rencher/infrastructure/ingress/README.md index 9d6d7ad..37f0a25 100644 --- a/k3s_rencher/infrastructure/ingress/README.md +++ b/k3s_rencher/infrastructure/ingress/README.md @@ -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. diff --git a/k3s_rencher/infrastructure/ingress/http-redirect.yaml b/k3s_rencher/infrastructure/ingress/http-redirect.yaml deleted file mode 100644 index e5cd516..0000000 --- a/k3s_rencher/infrastructure/ingress/http-redirect.yaml +++ /dev/null @@ -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 diff --git a/k3s_rencher/infrastructure/ingress/kustomization.yaml b/k3s_rencher/infrastructure/ingress/kustomization.yaml index 2626367..9628179 100644 --- a/k3s_rencher/infrastructure/ingress/kustomization.yaml +++ b/k3s_rencher/infrastructure/ingress/kustomization.yaml @@ -3,5 +3,4 @@ kind: Kustomization resources: - swarm-backends.yaml - traefik-https-config.yaml - - http-redirect.yaml - public-ingress.yaml diff --git a/k3s_rencher/infrastructure/ingress/traefik-https-config.yaml b/k3s_rencher/infrastructure/ingress/traefik-https-config.yaml index 3fb3124..9780685 100644 --- a/k3s_rencher/infrastructure/ingress/traefik-https-config.yaml +++ b/k3s_rencher/infrastructure/ingress/traefik-https-config.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"