<p>I have dockerized and created deployment and service for both front(REACT) and backend (EXPRESS NODE JS) project in kubernetes. I have successfully deployed in Kubernetes(Single node cluster) in Same Node with Two Pods(i.e <strong>One Pod --> REACT APP and SECOND POD --> EXPRESS NODE JS</strong>) in Google cloud Platform. </p>

<p><strong><em>Question:</em></strong></p>

<p>1.) How to communicate from one pod to another pod inside the Node in Kubernetes cluster?</p>

<p>2.) I have exposed my REACT app to the Outer world by creating <strong>LoadBalancer</strong> Type Service in <strong>kubernetes</strong> and i am able to access the React App Endpoint from the Browser. Now, Is it possible to access EXPRESS app from REACT app inside the node without exposing my EXPRESS app to outer world. How to achieve this? </p>

<p>Thanks in Advance.</p>

Vignesh
<p>When the frontend is a browser-based JavaScript app then the JavaScript resources may be hosted from a Pod in the cluster but the logic doesn't run there. The fronted JavaScript runs in the user's browser. Calling any backend endpoints in the cluster from the user's browser requires an external URL somewhere along the chain and not just an internal one.</p>

<p>A typical way to do this is to set up a Service of type LoadBalancer and put the external endpoint into the backend's config. Another is to set up an Ingress Controller and deploy both Service and Ingress along with the backend. With Ingress you can know what the external URL will be before you deploy the Service (and this is easiest if you use DNS). Cluster-internal communication doesn't need Ingress and can be done with Services of type ClusterIP but I think you need external communication. </p>

<p>You will need to expose an external entry point for users to hit the UI anyway (the place where the JS is hosted). With ingress you could configure the route to the backend as a different path on the same (external) host. </p>
