<p>I'm trying to run a simple node server on port <code>8080</code>, but with the following config any attempt at hitting the subdomain results in a <code>502 Bad Gateway</code> error. If I go the node I can see there doesn't appear to be any ports open on the container itself. So, assuming I've checked everything correctly, is there anything else I need to do in the config to open the port for the node server?</p>
<p>Edit: If I ssh into the pod and <code>curl</code> localhost on <code>8080</code> I'm able to hit the node server.</p>
<p><a href="https://i.stack.imgur.com/OrKIP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OrKIP.png" alt="enter image description here" /></a></p>
<p><strong>Dockerfile</strong></p>
<pre><code>FROM node:12.18.1

WORKDIR /app
COPY [&quot;package.json&quot;, &quot;package-lock.json*&quot;, &quot;./&quot;]
RUN npm install 
COPY . .
RUN npm run build

EXPOSE 8080
CMD [ &quot;node&quot;, &quot;server.js&quot; ]
</code></pre>
<p><strong>k8s deployment</strong></p>
<pre><code>spec:
  containers:
  - name: test
    image: test_image
    ports:
    - name: http
      protocol: TCP
      containerPort: 8080
</code></pre>
<p><strong>service yaml</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: test-service
spec:
  ports:
  - name: http
    port: 80
    targetPort: 8080
    protocol: TCP
  - name: https
    port: 443
    targetPort: 8080
    protocol: TCP
  selector:
    app: test-deployment
  type: NodePort
  externalTrafficPolicy: Cluster
</code></pre>
<p><strong>Ingress</strong></p>
<pre><code>spec:
  rules:
  - host: dev.test.com
    http:
      paths:
      - backend:
          serviceName: test-service
          servicePort: 80
        path: /
</code></pre>

NealR
<p>This wound up being on the application side. The server needed to be bound to <code>0.0.0.0</code> instead of <code>127.0.0.1</code>.</p>
<p><a href="https://i.stack.imgur.com/yTV6B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yTV6B.png" alt="enter image description here" /></a></p>
