<p>Nginx by default support 'Round Robin' load balancing and if i have kubernetes service type as 'LoadBalancer' (i think this is network-LB of the service provider? like <a href="https://www.digitalocean.com/products/load-balancer/" rel="nofollow noreferrer">this</a>) wouldn't that will make two load balancers in the stack (in theory)?</p>

<p>Assuming, i have single web-app behind nginx (web-server) so i guess in this case no nginx-LB will happen. But when it scales to multiple web-app behind nginx it would start load-balancing. </p>

<p>What is the best topology, having all the web-app utilizing network load-balancer (hardware) or multiple web-apps behind single nginx? </p>

<p>1) Single nginx for multiple web-app(s)</p>

<pre><code>                          |=&gt; web-app
network-LB &lt;==&gt; nginx-LB &lt;==&gt; web-app
                          |=&gt; web-app
</code></pre>

<p>2) Let network LB do the balancing and nginx for each web-app as web-server? </p>

<pre><code>                nginx-LB &lt;==&gt; web-app
network-LB &lt;==&gt; nginx-LB &lt;==&gt; web-app
                nginx-LB &lt;==&gt; web-app
</code></pre>

<p>So the general flow for this would be to incorporate an Nginx ingress instead of Nginx as a LB, as the Nginx ingress controller is optimized for this kind of routing and supports autoscaling so you don't need to handle anything underload, the idea being. </p>

<pre><code>                                               |=&gt; web-app
network-LB &lt;==&gt; nginx-controller (one or more) &lt;==&gt; web-app
                                               |=&gt; web-app
</code></pre>

<p>However your nginx conroller does a bit of magic where it watches the endpoints of your webapps and on change updates the config so there is one less hop (more optimal than normal routing that would need to do an IP lookup before hand). You can read more about nginx ingress <a href="https://kubernetes.github.io/ingress-nginx/" rel="nofollow noreferrer">here</a></p>
