title: Python code that works locally does not work on Kubernetes clusters
body: <p>I am working on a web server with a Python flask and passing data to the post method.</p>
  
  <p>Let's say your Python flask web server is A, and B is a python file that sends data to server A as a post.</p>
  
  <p>I planned to create a pod through deployment of A and pod as a job.</p>
  
  <p>When testing on a local computer, it ran without problems and replaced only the ip address with the Kubernetes service name (to use the dns service).</p>
  
  <p>But the problem is A 500 error.</p>
  
  <p>I don't know what's wrong ... Please help me.</p>
  
  <pre><code>class Influx_Request3(Resource):
      def post(self):
          try:
              parser = reqparse.RequestParser()
              parser.add_argument('carlist', type=str)
              parser.add_argument('cardataframe', type=str)
              parser.add_argument('cardict', type=str)
              args = parser.parse_args()
  
              print(args.carlist)
              print("args")
  
              _carlist = args['carlist']
              _cardataframe = args['cardataframe']
              _cardict = args['cardict']
  
              print(_carlist)
              print("_carlist")
  
              Analysis_Extraction_post(2019, 10, 14, 1, _carlist, _cardataframe, _cardict)
          except Exception as e:
              return {'error':str(e)}
  </code></pre>
  
  <p>This is the part that receives data from A web server.</p>
  
  <p>Try printing '_carlist' and 'args' with print will not print.</p>
  
  <p>If you try kubectl logs pod(A)</p>
  
  <p><code>10.244.1.46--[10 / Jan / 2020 08:17:50]" POST / extraction3 HTTP / 1.1 "500-</code></p>
  
  <p>Only output like this</p>
  
  <pre><code>NAME                                        READY   STATUS      RESTARTS   AGE
  pod/analysis-extraction-6477dcc645-vcfdw    1/1     Running     0          10m
  pod/analysis-influxinput-588d458f87-j48ls   1/1     Running     0          3h2m
  pod/analysis-mongo-7p6sd                    0/1     Completed   0          10m
  pod/busybox                                 1/1     Running     27         27h
  pod/influx-695b89d797-h2fck                 1/1     Running     0          3h
  pod/webserver-589dd46884-mzq5d              1/1     Running     0          3h
  
  NAME                       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
  service/extraction-svc     ClusterIP   10.96.40.221    &lt;none&gt;        3000/TCP   3h1m
  service/influxinput-svc    ClusterIP   10.96.153.210   &lt;none&gt;        5000/TCP   3h2m
  service/influxservice      ClusterIP   10.96.212.119   &lt;none&gt;        8086/TCP   3h
  service/kubernetes         ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP    3h3m
  service/webserverservice   ClusterIP   10.96.33.170    &lt;none&gt;        3000/TCP   3h
  
  NAME                                   READY   UP-TO-DATE   AVAILABLE   AGE
  deployment.apps/analysis-extraction    1/1     1            1           10m
  deployment.apps/analysis-influxinput   1/1     1            1           3h2m
  deployment.apps/influx                 1/1     1            1           3h
  deployment.apps/webserver              1/1     1            1           3h
  
  NAME                                              DESIRED   CURRENT   READY   AGE
  replicaset.apps/analysis-extraction-6477dcc645    1         1         1       10m
  replicaset.apps/analysis-influxinput-588d458f87   1         1         1       3h2m
  replicaset.apps/influx-695b89d797                 1         1         1       3h
  replicaset.apps/webserver-589dd46884              1         1         1       3h
  
  NAME                       COMPLETIONS   DURATION   AGE
  job.batch/analysis-mongo   1/1           2m24s      10m
  
  
  </code></pre>
  
  <hr>
  
  <p>The code you are requesting.</p>
  
  <pre><code>    carlist = json.dumps(carList, cls=NumpyEncoder)
      cardataframe = df_service.to_json()
      cardict = json.dumps(col_dict)
  
      data = {'carlist':carlist, 'cardataframe':cardataframe, 'cardict':cardict}
      res = requests.post('http://extraction-svc:3000/extraction3', data=data)
      print("request success")
  
  </code></pre>
  
  <p><a href="https://www.programcreek.com/python/example/104294/flask_restful.reqparse.RequestParser" rel="nofollow noreferrer">https://www.programcreek.com/python/example/104294/flask_restful.reqparse.RequestParser</a> </p>
  
  <p>This is the site I referenced.</p>
  
  <p>See the third example.</p>
  
  <p>Try again and return a response code of 200. But still no output.</p>
  
  <pre><code>10.244.1.53 - - [13/Jan/2020 02:31:46] "POST /extraction3 HTTP/1.1" 200 -
  
  </code></pre>
  
  <hr>
  
  <p>kubectl describe service extraction-svc </p>
  
  <pre><code>Name:              extraction-svc
  Namespace:         default
  Labels:            &lt;none&gt;
  Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                       {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"extraction-svc","namespace":"default"},"spec":{"ports":[{"port":3...
  Selector:          app=analysis-extraction
  Type:              ClusterIP
  IP:                10.96.8.131
  Port:              &lt;unset&gt;  3000/TCP
  TargetPort:        3000/TCP
  Endpoints:         10.244.1.63:3000
  Session Affinity:  None
  Events:            &lt;none&gt;
  
  
  </code></pre>