Kubernetes LoadBalncer http->https redirection does not work

Hi there!

I’m setting up Nginx ingress controller on my Kubernetes Cluster, and I can’t make http->https redirect to work.

apiVersion: v1
kind: Service
  name: nginx-ingress-controller
    component: "controller"
  annotations: "https" "d6312b2d-c313-4b03-9030-ccc40f1afed5" "false" "true"
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: http
    app: nginx-ingress
    component: "controller"
  type: "LoadBalancer"

As you can see in nginx ingress controller Service definition, I’m using correct annotation, however, when I visit, I get ERR_CONNECTION_REFUSED, instead of getting redirection to https.

When I use, it works as expected, i.e. response from ingress resource is rendered.

Did I configure nginx ingress correctly? What am I missing? Thank you.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I had the same issue, using the same YAML as you. I solved it by adding the following annotation “http”

This sets the correct forwarding rules protocol in the load balancer and the http to https now works