3

I have attached AWS ACM provided SSL certificate to NLB. NLB will forward request to nginx ingress. Nginx is giving me the following error. The plain HTTP request was sent to HTTPS port. I have set the following annotation in nginx ingress.

  • nginx.ingress.kubernetes.io/force-ssl-redirect: false
  • nginx.ingress.kubernetes.io/ssl-redirect: false

I have set following annotation in nginx ingress service which is running behind NLB.

  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
  • service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "certificate arn"
  • service.beta.kubernetes.io/aws-load-balancer-ssl-ports: https
  • service.beta.kubernetes.io/aws-load-balancer-type: nlb
Amnon
  • 2,212
  • 1
  • 19
  • 35
Akshay Gopani
  • 473
  • 4
  • 16

1 Answers1

5

For this error :

The plain HTTP request was sent to HTTPS port

Change your port configuration in Nginx service like, your target port in HTTPS section should be http instead of https

ports:
  - name: https
    **targetPort: http**

Here the annotation for reference

service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "60"
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:ap-southeast-1:xxxxxxx:certificate/8991ftt8-69e0-4e7d-1164-yy0aae19da90v
service.beta.kubernetes.io/aws-load-balancer-type: nlb
Markus R
  • 5,572
  • 1
  • 14
  • 9
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
  • this is working. but when i send http request it is not working. for https request it is working fine. @HarshManvar – Akshay Gopani Jan 12 '22 at 09:50
  • 1
    or you might would like to use `service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"` – Harsh Manvar Jan 12 '22 at 10:09
  • 1
    you can redirect your http traffic to https now so all request coming to http will auto redirect to https as it's working now so. so your ssl termination will be at nlb level. `service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"` – Harsh Manvar Jan 12 '22 at 10:11
  • refrence document : https://aws.amazon.com/premiumsupport/knowledge-center/terminate-https-traffic-eks-acm/ – Harsh Manvar Jan 12 '22 at 10:12