title: Access data produced in a pod from a different pod in Kubernetes
body: <p>I have a pod, called pod1 that runs a function which produces an array with random unordered integer elements and have also a service for this pod.
  In addition, in the same cluster i have an other pod, called pod2 which runs a sorting function.</p>
  <p>The pod1 has the following python code:</p>
  <pre><code>from flask import Flask,jsonify
  
  app = Flask(__name__)
  
  numbers= [1, 3, 5, 7, 9, 10, 2, 8]
  
  
  @app.route('/numbers')
  def get_numbers():
     return jsonify(incomes)
  
  if __name__==&quot;__main__&quot;:
     app.run(port='8080', debug=True)
  </code></pre>
  <p>Also the deployment file of the above pod is the following:</p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: flaskapp
    labels:
      app: flaskapp
  spec:
    selector:
      matchLabels:
        app: flaskapp
    replicas: 1
    template:
      metadata:
        labels:
          app: flaskapp
      spec:
        containers:
        - name: flaskapp
          image: application:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8080
  ---
  apiVersion: v1
  kind: Service
  metadata:
    name: flaskapp
  spec:
    ports:
    - name: http
      port: 8080
      targetPort: 8080
    selector:
      app: flaskapp
  </code></pre>
  <p>In addition i have also another pod whi acts like a client and has the folloowing code:</p>
  <pre><code>import requests
  
  x = requests.get('http://flaskapp:8080/numbers')
  print(x.text)
  </code></pre>
  <p>in the http the flaskapp is the name of the service of pod1.</p>
  <p>So when i apply the deployment file of pod2, the client pod is running succesfully but when i use the kubectl logs for that pod in order to see the expected output, nothing happens.</p>
  <p>Is the definition of the requests.get('http://flaskapp:8080/numbers') correct? What i am doing wrong?</p>