<p>I am using Kubernetes in minikube on Ubuntu 18.04 with ingress add-on enabled.
I want my NextJS service to communicate to my Express Service connected via ingress server by making request only via Ingress controller. So when I use cross namespace communication it doesn't work as illustrated in the tutorial presented. Since ingress-nginx in minikube runs on kube-system namespace.</p>
<pre><code>$ kubectl get service -n kube-system

NAME                                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                  AGE
ingress-nginx-controller-admission   ClusterIP   10.103.20.47   none          443/TCP                  15d
kube-dns                             ClusterIP   10.96.0.10     none          53/UDP,53/TCP,9153/TCP   36d
</code></pre>
<p>The services that I am running</p>
<pre><code>$ kubectl get services
NAME             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE
exp-mongo-srv    ClusterIP   10.103.255.125   &lt;none&gt;        27017/TCP   42s
exp-srv          ClusterIP   10.103.118.45    &lt;none&gt;        3000/TCP    42s
next-srv         ClusterIP   10.108.158.184   &lt;none&gt;        3000/TCP    39s

</code></pre>
<p>Expected request url was: http://ingress-nginx.ingress-nginx.svc.cluster.local(Communication through nginx)<br>
But instead I have to go through <code>http://exp-srv:3000</code> (Which is direct communication between services)</p>

Pramod Choudhary
<p>It is so simple to do it</p>
<p>you have added wrong namespace name</p>
<p>instead of</p>
<pre><code>http://ingress-nginx.ingress-nginx.svc.cluster.local
</code></pre>
<p>it should be</p>
<pre><code>http://ingress-nginx.kube-system.svc.cluster.local
</code></pre>
<p>if you want to use it as host and want to resolve it</p>
<p>If you are using ambassador to any other API gateway for service located in another namespace it's always suggested to use :</p>
<pre><code>            Use : &lt;service name&gt;
            Use : &lt;service.name&gt;.&lt;namespace name&gt;
            Not : &lt;service.name&gt;.&lt;namespace name&gt;.svc.cluster.local
</code></pre>
<p>it will be like : <code>servicename.namespacename.svc.cluster.local</code></p>
<p>this will send request to a particular service inside the namespace you have mention.</p>
<p>example:</p>
<pre><code>kind: Service
apiVersion: v1
metadata:
  name: service
spec:
  type: ExternalName
  externalName: &lt;servicename&gt;.&lt;namespace&gt;.svc.cluster.local
</code></pre>
<p>Here replace the <code>&lt;servicename&gt;</code> and <code>&lt;namespace&gt;</code> with the appropriate value.</p>
<p>In Kubernetes, namespaces are used to create virtual environment but all are connect with each other.</p>
