title: How to send data from a container within a Pod, to a container within a separate Pod - within the same cluster?
body: <p>I have a React frontend and a node.js backend. Each are in separate containers within separate Pods within the same cluster in k8's.
  I want to send data between them without having to use IP addresses. I know Kubernetes has a feature that lets you talk between pods inside the same cluster, and i think its related to the selector label defined within the Service files created.</p>
  
  <p>I have created a ClusterIp service for my React app and another ClusterIp for my server. I have created an ingress file for my application. I know my ingress works as i can access my UI, and i can hit my health check endpoint of my server - so i know they are exposed to the outside world correctly. My problem is how to communicate internally within k8's</p>
  
  <p>Within the my react app i have tried to write 
   axios.post("/api/test", {
        value: "TestValue"
      });
  But the endpoint within my server of api/test never gets hit with this.</p>
  
  <pre><code>Backend Server Cluster IP - - - -           
  
  apiVersion: v1
  kind: Service
  metadata:
    name: server-model-cluster-ip-service
  spec:
    type: ClusterIP
    selector:
      component: server-model
    ports:
      - port: 8050
        targetPort: 8050
  </code></pre>
  
  <p>React UI Cluster IP - - - -  
  <code>
  apiVersion: v1
  kind: Service
  metadata:
    name: react-ui-cluster-ip-service
  spec:
    type: ClusterIP
    selector:
      component: react-ui
    ports:
      - port: 3000
        targetPort: 3000</code>       </p>
  
  <p>Ingress File - - - - -</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: ingress-service
    annotations:
      kubernetes.io/ingress.class: nginx
      nginx.ingress.kubernetes.io/rewrite-target: /$1
  spec:
    rules:
      - http:
          paths:
            - path: /api/?(.*)
              backend:
                serviceName: react-ui-cluster-ip-service
                servicePort: 8050
            - path: /server/?(.*)
              backend:
                serviceName: server-model-cluster-ip-service
                servicePort: 8050
  </code></pre>
  
  <p>I understand the Label selector is what maps my React Cluster IP to the Deployment for my UI and similar for my Server Cluster IP to my Deployment for server. I thin i am right in saying i can use the selector somehow to send axis/http requests to other pods like.. </p>
  
  <p>axios.post("/PODNAME/api/test", {
        value: "TestValue"
      });</p>
  
  <p>Could anyone tell me if i am completely wrong or missing something obvious please :)</p>