<p>I am receiving the following error from the <code>ingress-nginx-controller</code>, which ultimately gives me the <code>502 Bad Gateway</code>. I can port forward into my nodejs service without error.</p>

<p><code>2020/05/30 21:31:12 [error] 485#485: *18798 connect() failed (111: Connection refused) while connecting to upstream, client: 177.183.249.235, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://10.244.0.249:3000/favicon.ico", host: "167.172.15.8", referrer: "http://167.172.15.8/"</code></p>

<p>I am using Pulumi and the following is the defined service:</p>

<pre><code>export const frontendService = new k8s.core.v1.Service(config.appNameFrontend, {
  metadata: {
    namespace: namespace.metadata.name,
    labels: {
      app: config.appNameFrontend,
      service: config.appNameFrontend
    }
  },
  spec: {
    ports: [{
      name: "http",
      port: 80,
      targetPort: 3000
    }],
    selector: {
      app: config.appNameFrontend
    }
  }
})
`
</code></pre>

<p>The deployment:</p>

<pre><code>const frontendDeployment = new k8s.apps.v1.Deployment(`${config.appNameFrontend}-${config.version}`, {
  metadata: {
    namespace: namespace.metadata.name,
    labels: {
      app: config.appNameFrontend,
      version: config.version,
    },
  },
  spec: {
    replicas: 1,
    selector: {
      matchLabels: {
        app: config.appNameFrontend,
        version: config.version
      }
    },
    template: {
      metadata: {
        labels: {
          app: config.appNameFrontend,
          version: config.version
        }
      },
      spec: {
        serviceAccountName: frontendServiceAccount.metadata.name,
        containers: [{
          name: config.appNameFrontend,
          image: "registry.digitalocean.com/connecttv/connecttv-frontend:latest",
          imagePullPolicy: "Always",
          resources: {
            limits: {
              cpu: "1000m"
            },
            requests: {
              cpu: "100m"
            }
          },
          ports: [{
            containerPort: 3000
          }]
        }],
        restartPolicy: "Always",
        imagePullSecrets: [{
          name: pulumi.interpolate`${imagePullSecret.metadata.name}`
        }]
      }
    }
  }
})
</code></pre>

<p>and finally the ingress:</p>

<pre><code>const frontendIngress = new k8s.networking.v1beta1.Ingress(`frontend-ingress-${config.projectName}-v1`, {
  metadata: {
    namespace: namespace.metadata.name,
    annotations: {
      "kubernetes.io/ingress.class": "nginx"
    }
  },
  spec: {
    rules: [
      {
        http: {
          paths: [
            {
              path: "/",
              backend: {
                serviceName: frontendService.metadata.name,
                servicePort: frontendService.spec.ports[0].port,
              },
            }
          ],
        },
      },
    ],
  },
});
</code></pre>

<p>Any ideas what would be causing this?</p>

<p>I used the 0.32.0 version to install nginx ingress (digitalocean).</p>

<p>However, i modified the <code>deploy.yaml</code> to <code>externalTrafficPolicy: Cluster</code> from <code>local</code>.</p>

Jesse Quinn
<p>Fixed. Always check your dockerfile! It was set to listen to <strong>localhost</strong> only!!!!</p>
