How to force SSL for Kubernetes Ingress on GKE

后端 未结 7 2168
情话喂你
情话喂你 2020-11-28 07:38

Is there a way to force an SSL upgrade for incoming connections on the ingress load-balancer? Or if that is not possible with, can I disable port :80? I haven\'t found a goo

7条回答
  •  臣服心动
    2020-11-28 08:05

    Redirecting to HTTPS in Kubernetes is somewhat complicated. In my experience, you'll probably want to use an ingress controller such as Ambassador or ingress-nginx to control routing to your services, as opposed to having your load balancer route directly to your services.

    Assuming you're using an ingress controller, then:

    • If you're terminating TLS at the external load balancer and the LB is running in L7 mode (i.e., HTTP/HTTPS), then your ingress controller needs to use X-Forwarded-Proto, and issue a redirect accordingly.
    • If you're terminating TLS at the external load balancer and the LB is running in TCP/L4 mode, then your ingress controller needs to use the PROXY protocol to do the redirect.
    • You can also terminate TLS directly in your ingress controller, in which case it has all the necessary information to do the redirect.

    Here's a tutorial on how to do this in Ambassador.

提交回复
热议问题