<p>Conditions:
I have a <em>3 tier application</em> to deploy using Kubernetes. I have created <strong>two namespaces</strong> for <em>backend</em> and <em>frontend</em> respectively.</p>
<p>Problem:
I want to know how would my <strong>backend</strong> talk to the <strong>frontend</strong> or vice versa.</p>
<p>In simple words, how do backend and frontend communicate if they are in different namespaces?</p>

Mohit Bhatt
<p>There's two ways: internal-only and external.</p>
<p>For both, create a kubernetes service for the front and back end services.</p>
<p>For external, the service type must <code>LoadBalancer</code>. You install the <a href="https://github.com/kubernetes-sigs/external-dns" rel="nofollow noreferrer">External DNS</a> plugin which will let you create an external DNS name that you can access by the other service. This will also allow you to access the service outside the cluster if you wish.</p>
<p>For internal, you make the service type <code>ClusterIP</code> or <code>NodePort</code>. When you create the service, you can then access them using the format: <code>service-name.namespace.svc.cluster.local</code></p>
<p>For example, an <code>nginx</code> service running on the namespace <code>internal</code> would be accessed as the DNS name <code>nginx.internal.svc.cluster.local</code></p>
<p>This service cannot be accessed outside of the cluster.</p>
<p>You can sometimes drop the <code>cluster.local</code> part, but I include it as habit.</p>
