<p>Hello Kubernetes Experts,</p>
<p>Trying to get a better understanding here.</p>
<p>I have created a deployment with a regular deployment yaml and service yaml
The service is node port, I then created a ingress and pointed the service</p>
<p>Tried to access the service and it works as expected on the default port of 80 on nginx ingress.</p>
<p>Next created the same deployment and service file. The only exception here was insted of node port is chose ClusterIP. Created a Ingress and pointed the service.</p>
<p>Tried to access the service and it simply fails with the nginx home page and does not do any routing to my application.</p>
<p>I understand that nodeport is what exposes the application to the external world.
But then I'm using Ingress to attain the same functionality.</p>
<p>Do we really need to set the service as node port even if we use Ingress???</p>
<p>Or is something terribly wrong with my yaml files. I tried reading about it and could not get any relevant explanation.</p>
<p>Thank you,
Anish</p>

anish anil
<p>First, the <code>Service</code> and <code>Ingress</code> resources works a bit different across cloud providers. E.g. on Google Cloud Platform and <a href="https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html" rel="nofollow noreferrer">AWS</a>, you need to use a <code>NodePort</code> service when using <code>Ingress</code> but on e.g. OpenShift <code>ClusterIP</code> is working.</p>
<p>Mostly, the reason is that the <em>Load Balancer</em> is <strong>located outside</strong> of your cluster (this is not the case on the OpenShift environment where I work).</p>
<p>From <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/ingress" rel="nofollow noreferrer">Google Cloud documentation</a>, use <code>NodePort</code> for load balancing but <code>ClusterIP</code> if your load balancer is &quot;container native&quot;.</p>
<blockquote>
<p>In the Service manifest, you must use type: NodePort unless you're using container native load balancing. If using container native load balancing, use the type: ClusterIP.</p>
</blockquote>
