feat: HTTP→HTTPS 自动跳转
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled

- 新增 redirect-https-middleware.yaml(Traefik Middleware)
- Ingress 加 traefik.ingress.kubernetes.io/router.middlewares annotation
- CI 流水线在 Ingress 之前 apply middleware

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
zyc 2026-04-13 14:50:06 +08:00
parent 43f885e22a
commit d8204c8572
4 changed files with 11 additions and 0 deletions

View File

@ -112,6 +112,7 @@ jobs:
--dry-run=client -o yaml | kubectl apply -f - --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f k8s/cert-manager-issuer.yaml kubectl apply -f k8s/cert-manager-issuer.yaml
kubectl apply -f k8s/redirect-https-middleware.yaml
kubectl apply -f k8s/backend-deployment.yaml kubectl apply -f k8s/backend-deployment.yaml
kubectl apply -f k8s/backend-ingress.yaml kubectl apply -f k8s/backend-ingress.yaml
kubectl apply -f k8s/web-deployment.yaml kubectl apply -f k8s/web-deployment.yaml

View File

@ -5,6 +5,7 @@ metadata:
annotations: annotations:
kubernetes.io/ingress.class: "traefik" kubernetes.io/ingress.class: "traefik"
cert-manager.io/cluster-issuer: "letsencrypt-prod" cert-manager.io/cluster-issuer: "letsencrypt-prod"
traefik.ingress.kubernetes.io/router.middlewares: "default-redirect-https@kubernetescrd"
spec: spec:
tls: tls:
- hosts: - hosts:

View File

@ -0,0 +1,8 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: redirect-https
spec:
redirectScheme:
scheme: https
permanent: true

View File

@ -5,6 +5,7 @@ metadata:
annotations: annotations:
kubernetes.io/ingress.class: "traefik" kubernetes.io/ingress.class: "traefik"
cert-manager.io/cluster-issuer: "letsencrypt-prod" cert-manager.io/cluster-issuer: "letsencrypt-prod"
traefik.ingress.kubernetes.io/router.middlewares: "default-redirect-https@kubernetescrd"
spec: spec:
tls: tls:
- hosts: - hosts: