<p>I am trying to consume Python Rest API call from a container running inside the Kubernetes.
I am able to consume the service inside the pod</p>

<pre><code>*curl http://localhost:5002/analyst_rating -v
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5002 (#0)
&gt; GET /analyst_rating HTTP/1.1
&gt; Host: localhost:5002
&gt; User-Agent: curl/7.47.0
&gt; Accept: */*
&gt; 
* HTTP 1.0, assume close after body
&lt; HTTP/1.0 200 OK
&lt; Content-Type: application/json
&lt; Content-Length: 37
&lt; Server: Werkzeug/0.12.2 Python/2.7.12
&lt; Date: Tue, 05 Dec 2017 17:02:00 GMT
&lt; 
{
  "Analyst Rating": "Hello World"
* Closing connection 0*
</code></pre>

<p>When I am running the curl command from outside the cluster, I am getting the below error:</p>

<pre><code>    curl -I http://184.173.44.62:30484/analyst_rating -v
*   Trying 184.173.44.62...
* TCP_NODELAY set
* Connected to 184.173.44.62 (184.173.44.62) port 30484 (#0)
&gt; HEAD /analyst_rating HTTP/1.1
&gt; Host: 184.173.44.62:30484
&gt; User-Agent: curl/7.54.0
&gt; Accept: */*
&gt; 
* Closing connection 0
curl: (8) Weird server reply
</code></pre>

<p>My Cluster IP is 184.173.44.62 and my service node port is 30484.
I am able to make connections but not able to receive any response.
Also, I have checked inside the pod, I am not getting any GET request.</p>

<p>Also, Following is my deployment info: </p>

<pre><code>kubectl describe deployment
Name:                   sunlife-analystrating-deployment
Namespace:              default
CreationTimestamp:      Tue, 05 Dec 2017 10:53:53 -0500
Labels:                 app=sunlife-analystrating-deployment
Annotations:            deployment.kubernetes.io/revision=1
Selector:               app=sunlife-analystrating-deployment
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  1 max unavailable, 1 max surge
Pod Template:
  Labels:  app=sunlife-analystrating-deployment
  Containers:
   sunlife-analystrating-deployment:
    Image:        registry.ng.bluemix.net/dockerservice/tensorflowrunningimage:02
    Port:         5002/TCP
    Environment:  &lt;none&gt;
    Mounts:       &lt;none&gt;
  Volumes:        &lt;none&gt;
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
OldReplicaSets:  &lt;none&gt;
NewReplicaSet:   sunlife-analystrating-deployment-3230069030 (1/1 replicas created)
Events:          &lt;none&gt;
</code></pre>

<p>and Following is my Service info:</p>

<pre><code>kubectl describe service
Name:              kubernetes
Namespace:         default
Labels:            component=apiserver
                   provider=kubernetes
Annotations:       &lt;none&gt;
Selector:          &lt;none&gt;
Type:              ClusterIP
IP:                172.21.0.1
Port:              https  443/TCP
TargetPort:        32444/TCP
Endpoints:         184.173.44.62:32444
Session Affinity:  ClientIP
Events:            &lt;none&gt;


Name:                     sunlife-analystrating-svc
Namespace:                default
Labels:                   &lt;none&gt;
Annotations:              &lt;none&gt;
Selector:                 app=sunlife-analystrating-deployment
Type:                     NodePort
IP:                       172.21.210.178
Port:                     &lt;unset&gt;  5002/TCP
TargetPort:               5002/TCP
NodePort:                 &lt;unset&gt;  30484/TCP
Endpoints:                172.30.111.147:5002
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>

<p>Following is the code snippet, that I have used to expose the rest client inside container</p>

<pre><code>-------
def get(self):
        print("Hello World")
        response="Hello World"
        result_dict = { 'Analyst Rating': str(response) }
        return jsonify(result_dict)
-------
if __name__ == '__main__':
     app.run(port='5002')
-------
</code></pre>

<p>You can't get any GET request because it seems that you use POST method </p>

<pre><code>*curl -I -X  POST http://184.173.44.62:30484/analyst_rating -v
</code></pre>

<p>Also, why do you use -I parameter? Try to execute:</p>

<pre><code>curl http://184.173.44.62:30484/analyst_rating -v
</code></pre>

<p>If this doesn't work, you'll have to provide more details about your k8s service specification</p>
