Ingress and nginx 502 bad gateway

#1

I can’t get Ingress working. I get 502 Bad Gateway errors from nginx. I am not running nginx in my workload, so I assume it is from the Nginx Ingress Controller.

I am running a bare-metal setup with no cloud provider with two worker nodes, one control plane, and one etcd node.

My workload is running. I can get to it through the IP address and NodePort.

Here is my Ingress YAML:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    field.cattle.io/creatorId: user-gqr8f
    field.cattle.io/ingressState: '{"":"default:","Y29wcy1tbHQvZGVmYXVsdC94aXAuaW8vL2NvcHMtbWx0LzM1MDA=":"deployment:default:cops-mlt-deployment"}'
    field.cattle.io/publicEndpoints: '[{"addresses":["10.100.186.215"],"port":443,"protocol":"HTTPS","serviceName":"default:ingress-5fd39c2a15055c598e828054905973d5","ingressName":"default:cops-mlt","hostname":"cops-mlt.default.10.100.186.215.xip.io","path":"/cops-mlt","allNodes":true}]'
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.org/ssl-services: cops-mlt-service
  creationTimestamp: 2018-11-02T17:48:30Z
  generation: 8
  labels:
    cattle.io/creator: norman
  name: cops-mlt
  namespace: default
  resourceVersion: "496522"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/cops-mlt
  uid: 82ac8f76-dec7-11e8-92a0-0050569b4af5
spec:
  rules:
  - host: cops-mlt.default.10.100.186.215.xip.io
    http:
      paths:
      - backend:
          serviceName: ingress-5fd39c2a15055c598e828054905973d5
          servicePort: 3500
        path: /cops-mlt
  tls:
  - hosts:
    - cops-mlt.default.10.100.186.215.xip.io
status:
  loadBalancer:
    ingress:
    - ip: 10.100.186.215
    - ip: 10.100.186.216

Does anyone have any ideas on what I can do to get this Ingress working? Thanks.

#2

+1

Having the same issue, where path-based rules result in 502 errors, only able to reach workload using hostname and NodePort.

#3

+1 having the same issue, setup rancher as per the startup instructions

#4

The same issue, the Ingress load balance does not work, and got 502 bad gateway error.

#5

The same issue (rancher 2.2, nginx 1.15.6)

#6

I apparently am having the same issue on 2.2.3. It was working on 2.2.2.

#7

502 means there is no working target pod to send the request to. Which usually means you have the wrong target port, or are selecting no pods.

2.2.3 contains only 2 commits to fix 1 issue which has nothing to do with ingress.

#8

I’ve made the mistake to enter the port of the workload instead of the exposed port of the docker container.