<p>How do I ping my api which is running in kubernetes environment in other namespace rather than default. Lets say I have pods running in 3 namespaces - default, dev, prod. I have ingress load balancer installed and configured the routing. I have no problem in accessing default namespace - <a href="https://localhost/myendpoint" rel="nofollow noreferrer">https://localhost/myendpoint</a>.... But how do I access the apis that are running different image versions in other namespaces eg dev or prod? Do I need to add additional configuration in service or ingress-service files?</p>

<p>EDIT: my pods are restful apis that communicates over http requests. All I’m asking how to access my pod which runs in other namespace rather than default. The deployments communicate between each other with no problem. Let’s say I have a front end application running and want to access it from the browser, how is it done? I can access if the pods are in the default namespace by hitting <a href="http://localhost/path" rel="nofollow noreferrer">http://localhost/path</a>... but if I delete all the pods from default namespace and move all the services and deoloyments into dev namespace, I cannot access it anymore from the browser with the same url. Does it have a specific path for different namespaces like <a href="http://localhost/dev/path" rel="nofollow noreferrer">http://localhost/dev/path</a>? Do I need to cinfigure it</p>

<p>Hopefully it's clear enough. Thank you</p>

<h2>Route traffic with Ingress to Service</h2>

<p>When you want to route request from external clients, via <code>Ingress</code> to a <code>Service</code>,  you should put the <code>Ingress</code> and <code>Service</code> object in the <em>same namespace</em>. I recommend to use different <em>domains</em> in your <code>Ingress</code> for the environments.</p>

<h2>Route traffic from Service to Service</h2>

<p>When you want to route traffic from a pod in your cluster to a <code>Service</code>, possible in another namespace, it is easiest to use <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">Service Discovery with DNS</a>, e.g. send request to:</p>

<pre><code>&lt;service-name&gt;.&lt;namespace&gt;.svc.&lt;configured-cluster-name&gt;.&lt;configured-name&gt;
</code></pre>

<p>this is most likely</p>

<pre><code>&lt;service-name&gt;.&lt;namespace&gt;.svc.cluster.local
</code></pre>
