<p>I have a pod running a Flask app in python, which is listening in port 8083. If I access the app from inside the pod, it works:</p>

<pre><code>    kubectl exec gen-759dcfd789-hscbr -c gen-pod -- curl http://localhost:8083

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
[...]
</code></pre>

<p>But when I look for the pod IP</p>

<pre><code>kubectl describe pod gen-759dcfd789-hscbr

Name:         gen-759dcfd789-hscbr
Namespace:    default
Priority:     0
Node:         [...]
Start Time:   Wed, 15 Apr 2020 19:18:12 +0200
Labels:       app=gen
              pod-template-hash=759dcfd789
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.1.45.187
IPs:
  IP:           10.1.45.187
Controlled By:  ReplicaSet/gen-759dcfd789
</code></pre>

<p>And try to access it from outside the pod</p>

<pre><code>curl http://10.1.45.187:8083
curl: (7) Failed to connect to 10.1.45.187 port 8083: Conexión rehusada
</code></pre>

<p>It can't connect.</p>

<p>I have done the same with other apps running in nodejs, and they work correctly. What can be happening here? How can I debug why it isn't connecting? Thanks in advance.</p>

<p>I'm leaving the yaml here:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: gen
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gen
  template:
    metadata:
      labels:
        app: gen
    spec:
      containers:
        - name: gen-pod
          image: roxax19/python3.7:0.1
          command:
            - bash
            - "-c"
            - python3.7 gen.py
          volumeMounts:
            - mountPath: /mount
              name: test-volume
      volumes:
        - name: test-volume
          hostPath:
            # directory location on host
            path: /home/manuel/tfg/mounts/gen
            # this field is optional
            type: Directory
</code></pre>

Manu Ruiz Ruiz
<p>Usually this is the case when the python app does only use the loopback interface to listen for connections. Make sure that the listening interface (host) is not 127.0.0.1 but 0.0.0.0</p>

<pre><code>    app.run(host='0.0.0.0', port=8080)
</code></pre>
