在由ALB ingress Controller创建的ALB上添加从HTTP重定向到HTTPS的设置

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: CONTAINER_NAME-app-ingress
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    external-dns.alpha.kubernetes.io/hostname: CONTAINER_NAME.vamdemic.xyz
    alb.ingress.kubernetes.io/tags: Name=vamdemic-development-k8s-alb,Automation=Kubernetes-ingress-controller,Domain=CONTAINER_NAME
    alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:ap-northeast-1:xxxxxxxxx:certificate/xxxxxxxxxxxxxxxx
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
    alb.ingress.kubernetes.io/ip-address-type: ipv4
    alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
  labels:
    app: CONTAINER_NAME-ingress
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: ssl-redirect
              servicePort: use-annotation
          - path: /*
            backend:
              serviceName: CONTAINER_NAME-app-service
              servicePort: 80
广告
将在 10 秒后关闭
bannerAds