<p>I've developed a containerized Flask application and I want to deploy it with Kubernetes. However, I can't connect the ports of the Container with the Service correctly.</p>
<p>Here is my Deployment file:</p>
<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: &lt;my-app-name&gt;
spec:
  replicas: 1

  template:
    metadata:
      labels:
        app: flaskapp
    spec:
      containers:
      - name: &lt;container-name&gt;
        image: &lt;container-image&gt;
        imagePullPolicy: IfNotPresent
        ports:  
        - containerPort: 5000
          name: http-port
---
apiVersion: v1
kind: Service
metadata:
  name: &lt;service-name&gt;
spec:
  selector:
    app: flaskapp
  ports:
  - name: http
    protocol: TCP
    targetPort: 5000
    port: 5000
    nodePort: 30013
  type: NodePort
</code></pre>
<p>When I run <code>kubectl get pods</code>, everything seems to work fine:</p>
<pre><code>NAME                              READY     STATUS    RESTARTS   AGE
&lt;pod-id&gt;                          1/1       Running   0          7m
</code></pre>
<p>When I run <code>kubectl get services</code>, I get the following:</p>
<pre><code>NAME                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         
&lt;service-name&gt;        NodePort    10.105.247.63   &lt;none&gt;      5000:30013/TCP
...
</code></pre>
<p>However, when I give the following URL to the browser: 10.105.247.63:30013, the browser keeps loading but never returns the data from the application.</p>
<p>Does anyone know where the problem could be? It seems that the service is not connected to the container's port.</p>

UrmLmn
<p><code>30013</code> is the port on the Node not in the cluster IP. To get a reply you would have to connect to <code>&lt;IP-address-of-the-node&gt;:30013</code>. To get the list of nodes you can:</p>

<pre><code>kubectl get nodes -o=wide
</code></pre>

<p>You can also go through the <code>CLUSTER-IP</code> but you'll have to use the exposed port <code>5000</code>: <code>10.105.247.63:5000</code></p>
