<p>Inside of a Kubernetes Cluster I am running 1 node with 2 deployments. React front-end and a .NET Core app. I also have a Load Balancer service for the front end app. (All working: I can port-forward to see the backend deployment working.) </p>

<p><strong>Question:</strong> I'm trying to get the front end and API to communicate. I know I can do that with an external facing load balancer but is there a way to do that using the clusterIPs and not have an external IP for the back end? </p>

<p>The reason we are interested in this, it simply adds one more layer of security. Keeping the API to vnet only, we are removing one more entry point. </p>

<p>If it helps, we are deploying in Azure with AKS. I know they have some weird deployment things sometimes.</p>

<p>Pods running on the cluster can talk to each other using a <code>ClusterIP</code> service, which is the default service type. You don't need a <code>LoadBalancer</code> service to make two pods talk to each other. According to <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">the docs on this topic</a></p>

<blockquote>
  <p>ClusterIP exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster. This is the default ServiceType.</p>
</blockquote>

<p>As explained in <a href="https://kubernetes.io/docs/concepts/services-networking/service/#dns" rel="nofollow noreferrer">the Discovery documentation</a>, if both Pods (frontend and API) are running on the same namespace, the frontend just needs to send requests to the name of the backend service.</p>

<p>If they are running on different namespaces, the frontend API needs to use a fully qualified domain name to be able to talk with the backend.</p>

<blockquote>
  <p>For example, if you have a Service called "my-service" in Kubernetes Namespace "my-ns" a DNS record for "my-service.my-ns" is created. Pods which exist in the "my-ns" Namespace should be able to find it by simply doing a name lookup for "my-service". Pods which exist in other Namespaces must qualify the name as "my-service.my-ns". The result of these name lookups is the cluster IP.</p>
</blockquote>

<p>You can find more info about how DNS works on kubernetes <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">in the docs</a>.</p>
