title: How can frontend communicate with backend if each is on a separate pod and host within kubernetes?
body: <p>I am trying to connect a simple application to emulate a frontend container in one pod on one host, which makes a request to another backend container in another pod on another host. This cluster was created by kops on AWS.</p>
  
  <p>The services are created correctly and I am able to reach the default frontend service at the LB url created by frontend service. However, the request /greet which calls backend hangs and eventually times out with 500 error. </p>
  
  <p>I checked logs but it doesn't show anything useful. Am I missing anything that would prevent the pods to communicate? </p>
  
  <p><a href="https://i.stack.imgur.com/b1LFp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b1LFp.png" alt="enter image description here"></a></p>
  
  <h1>sample-genericserver  "frontend"</h1>
  
  <pre><code>@app.route('/greet')
  def greet():
      r = requests.get('http://sample-greeter')
      print(r.content)
      return r.content
  
  if __name__ == "__main__":
      app.run(host="0.0.0.0", port=int("5000"), debug=True)
  
  //frontend
  kubectl run sample-genericserver --image=genericserver --replicas=1 --port=5000
  kubectl expose deployment sample-genericserver --port=5000 --type=LoadBalancer
  </code></pre>
  
  <h1>greeter "backend"</h1>
  
  <pre><code>@app.route('/')
  def hello_world():
      return 'Greetings from BackendService'
  
  if __name__ == "__main__":
      app.run(host="0.0.0.0", port=int("8090"), debug=True)
  
  
  //backend
  $ kubectl run sample-greeter --image=greeter --replicas=1 --port=8090
  $ kubectl expose deployment sample-greeter --port=8090
  </code></pre>