Why does my bare-metal kubernetes nginx Ingress-controller return a 308?

I was having issues with HTTP calls getting redirected to HTTPS (verified it with fiddler logs).

Adding this to my yml file made it work for me.

Annotations:

nginx.ingress.kubernetes.io/ssl-redirect: "false"

I was having the same problem, but I did not want to add the host value. To prevent the redirect HTTP to HTTPS by the default server like David mentioned, instead I added this annotation to the ingress and it fixed it for me: nginx.ingress.kubernetes.io/ssl-redirect: "false".

My working ingress looks like this now:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    kubernetes.io/ingress.class: "internal-nginx"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /*
        backend:
          serviceName: app1
          servicePort: 80
      - path: /app2/*
        backend:
          serviceName: app2
          servicePort: 80

The key here is to name a host, otherwise the ingress rule applies to the default server, which is configured to redirect HTTP to HTTPS by default.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: foo.bar.com
    http:
      paths:
      - path: /whoop
        backend:
          serviceName: test-deployment-service
          servicePort: 80

You should be able to disable the redirect behavior for the default server, bit I haven't tried that.