<p>I’m running a microservices project with server side rendering using Next.js</p>
<p>I’m using an Ingress Service to redirect requests to the correct micro service and route.</p>
<p>When the app first loads up, the getInitialProps method of the App component makes a request to an auth microservice which basically is going to let the client know if there is a currently logged in user or not.</p>
<p>Now, to create the url to make the get request from the client to the auth microservice I am using the following url structure:</p>
<pre><code>http://NAME_OF_SERVICE.NAMESPACE.svc.cluster.local
</code></pre>
<p>When I installed the <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">ingress nginx</a> locally, it was installed under a namespace called <code>ingress-nginx</code>.</p>
<p>And if I take a look at the services under that namespace, I get that the name of the service is: <code>ingress-nginx-controller</code></p>
<p>So the url to make the request from the client to the auth micro service would be:</p>
<pre><code>http://ingress-nginx-controller.ingress-nginx.svc.cluster.local
</code></pre>
<p>This is all locally and it runs smoothly.</p>
<p>However, the problem comes when I try to deploy in the Google Cloud.</p>
<p>In the Google Cloud, using the Google Kubernetes Engine, I’m installing the <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">Ingress Nginx</a> with Helm with the following command:</p>
<pre><code>helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install my-release ingress-nginx/ingress-nginx
</code></pre>
<p>This command installs ingress-nginx in the <code>default namespace</code>, and when I take a look at the services in the default namespace, I get that the name of the service is:</p>
<pre><code>my-release-ingress-nginx-controller
</code></pre>
<p>So the base url to make a request from the client to the auth microservice would be:</p>
<pre><code>http://my-release-ingress-nginx-controller.default.svc.cluster.local
</code></pre>
<p>However this doesn’t work and I get a <code>404 server error</code>.</p>
<p>I already tried removing the namespace and only referencing the service, like so:</p>
<pre><code>http://my-release-ingress-nginx-controller.svc.cluster.local
</code></pre>
<p>But now getting:</p>
<pre><code>Error: getaddrinfo ENOTFOUND my-release-ingress-nginx-controller.svc.cluster.local
</code></pre>
<p>How can I solve this?</p>

Diego
<p>Couple of questions:</p>
<ol>
<li>How did you install nginx ingress controller locally?</li>
<li><code>http://NAME_OF_SERVICE.NAMESPACE.svc.cluster.local</code> scheme works only if your app is trying to send traffic to other pods/services within the cluster. <strong>If your NextJS app is running in the browser (client side rendering I believe), then it needs a publicly accessible URL to the authentication service</strong>.</li>
<li>It seems that you're consuming Nginx ingress controller's own service created by its helm chart instead of <code>Ingress</code> resource which points to authentication app's <code>Service</code>. Where is the Ingress resource?</li>
</ol>
