<p>I understood Ingress can be used when we want to expose multiple service/routes with a single Load Balancer / public IP.</p>

<p>Now I want to expose my Nginx server to public. I have two choices</p>

<ol>
<li>Set <code>service type as LoadBalancer</code> voila I got public IP</li>
<li>Use <a href="https://github.com/kubernetes/ingress-nginx" rel="noreferrer">Nginx Ingress Controller</a></li>
</ol>

<p>Now I can get my job done with Option 1 when or why would I choose Option 2 whats the advantage of having nginx with Ingress without Ingress ?</p>

Siva
<p>There is a difference between <em>ingress rule (ingress)</em> and <em>ingress controller</em>. So, technically, nginx ingress controller and LoadBalancer type service are not comparable. You can compare ingress resource and LoadBalancer type service, which is below.</p>

<p><strong>Generally speaking:</strong></p>

<p><code>LoadBalancer</code> type service is a L4(TCP) load balancer. You would use it to expose single app or service to outside world. It would balance the load based on destination IP address and port.</p>

<p><code>Ingress</code> type resource would create a L7(HTTP/S) load balancer. You would use this to expose several services at the same time, as L7 LB is application aware, so it can determine where to send traffic depending on the application state.</p>

<p><strong><em>ingress</em> and <em>ingress controller</em> relation</strong>:</p>

<p><code>Ingress</code>, or <code>ingress rules</code> are the rules that <code>ingress controller</code> follows to distribute the load. Ingress controller get the packet, checks ingress rules and determines to which service to deliver the packet.</p>

<p><strong>Nginx Ingress Controller</strong></p>

<p>Nginx ingress controller uses LoadBalancer type service actually as entrypoint to the cluster. Then is checks ingress rules and distributes the load. This can be very confusing. You create an ingress resource, it creates the HTTP/S load balancer. It also gives you an external IP address (on GKE, for example), but when you try hitting that IP address, the connection is refused.</p>

<p><strong>Conclusions:</strong></p>

<p>You would use Loadbalancer type service if you would have a single app, say <code>myapp.com</code> that you want to be mapped to an IP address. </p>

<p>You would use ingress resource if you would have several apps, say <code>myapp1.com</code>, <code>myapp1.com/mypath</code>, <code>myapp2.com</code>, .., <code>myappn.com</code> to be mapped to one IP address. </p>

<p>As the ingress is L7 it is able to distinguish between <code>myapp1.com</code> and <code>myapp1.com/mypath</code>, it is able to route the traffic to the right service.</p>
