<p>I am running 3 nodes in Kubernetes cluster. Each node has the same Pod myApp.
I create a service using type NodePort so that all 3 Node is accessible from external.
The service yaml looks like below</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: myService
  labels:
    app: myApp
spec:
  selector:
    app: myApp
  type: NodePort
</code></pre>

<p>Suppose the Node IP + port of the 3 nodes are: <br>
1. 192.168.18.1:30010<br>
2. 192.168.18.2:30010<br>
3. 192.168.18.3:30010<br></p>

<p>My questions are: <br>
1. If all the requests comes to the single node with IP (192.168.18.1:30010), will the service load balancing the requests to Pod in other Nodes, or just the target node (IP 192.168.18.1:30010)?<br>
<br>
2. If the answer to Question 1 is yes, which mean service can load balancing request. Then do we still need any load balancer.</p>

<p>Thanks</p>

<ol>
<li><p>Yes load balancing will be provided by kube-proxy. If you look at the endpoints by describing a service you will find that IPs of pods backed by the service are listed there. So when request comes to the any nodes IP and NodePort it will be load balanced by kube-proxy between those pods. The way it works is request comes to one of the Node IP and port and then it goes to the cluster IP and then it gets load balanced to any of the pods behind the clusterIP.</p></li>
<li><p>load balancing by kube proxy happens at TCP layer via IP table rules. Loadbalancer provides load balancing at L7 layer(HTTP) and advanced routing rules based on HTTP header etc. So if you need that then you need use Loadbalancer. Another disadvantage of using nodeport is that if Node IP changes then client needs to be aware of that which can be avoided by using Loadbalancer which generally provides a DNS.</p></li>
</ol>

<p><a href="https://i.stack.imgur.com/Slh0q.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Slh0q.png" alt="enter image description here"></a></p>
