<p>As I can see in below diagram I figure out in kubernetes we have two <strong>loadbalancer</strong>. One of them loadbalance between nodes and one of them loadbalance between pods.</p>

<p>If I use them both I have two <strong>loadbalancer</strong>.</p>

<p>Imagine some user want to connect to <code>10.32.0.5</code> the kubernetes send its request to <code>node1(10.0.0.1)</code> and after that send the request to pod <code>(10.32.0.5)</code> in <code>nod3(10.0.0.3)</code> but it is unuseful because the best route is to send request  <code>nod3(10.0.0.3)</code> directly.</p>

<p>Why the NodePort is insufficient for load-balancing?</p>

<p>Why the NodePort is not LoadBalancer?(it LoadBalance between pods in different node but why we need another load balancer?)</p>

<p>note: I know that if I use NodePort and the node goes down it creates problem but I can say that I can use keepalived for it. The question is </p>

<p>why we need to loadbalance between nodes? keepalived attract all request to one IP.
Why we have two loadbalancer?<a href="https://i.stack.imgur.com/pIRU3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pIRU3.png" alt="enter image description here"></a></p>

<p>Wether you have two load-balancers depends on your setup.</p>

<p>In your example you have 3 nginx pods and 1 nginx service to access the pods. The service builds an abstraction layer, so you don't have to know how many pods there are and what IP addresses they have. You just have to talk to the service and it will loadbalance to one of the pods (<a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">docs</a>).</p>

<p>It now depends on your setup how you access the service:</p>

<ul>
<li>you might want to publish the service via NodePort. Then you can directly access the service on a node.</li>
<li>you might also publish it via LoadBalancer. This gives you another level of abstraction and the caller needs to know less about the actual setup of your cluster.</li>
</ul>

<p>See <a href="https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types" rel="nofollow noreferrer">docs</a> for details.</p>
