Answers: <p><code>service</code> is a cluster-wide object. In each node, <code>kube-proxy</code> will create <code>iptable</code> load balancing entry with all available pod's IP based on selector for a <code>service</code>. So NLB will distributed traffic evenly among all nodes. Then each will loadbalance the traffic to all available pods using round robin algorithm.</p>
  <p>We will have those traffic distributed among all pods like below.</p>
  <p>p1 -&gt; 33.3330%</p>
  <p>p2 -&gt; 33.3330%</p>
  <p>p3 -&gt; 16.6665%</p>
  <p>p4 -&gt; 16.6665%</p>
  <p>This will deviate a little bit.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-04-16T17:55:47.833Z
Answers: 2021-04-16T17:55:47.833Z
Answers: again
Body: <p>Let's assume I have three node named <code>n1</code>, <code>n2</code>, <code>n3</code>. created four pods named <code>p1</code>, <code>p2</code>, <code>p3</code>, <code>p4</code>, <code>k8s</code> scheduler placed pods in nodes as follows</p>
  <p>n1 -&gt; p1</p>
  <p>n2 -&gt; p2</p>
  <p>n3 -&gt; p3, p4</p>
  <p>Now, to access these pods I have created a <code>nodeport</code> service. <code>Nodeport</code> service will open same numbered ports in each nodes. Nodes will have <code>iptables</code> configured to forward traffics from service to pods.</p>
  <p>Let's also assume that I will have a NLB configured top of it. how traffic will be distributed? is it like below?</p>
  <p>p1 -&gt; 33.3330%</p>
  <p>p2 -&gt; 33.3330%</p>
  <p>p3 -&gt; 16.6665%</p>
  <p>p4 -&gt; 16.6665%</p>
  
Tags: <kubernetes><microservices>
Title: kubernetes nodeport service load balancing
UserDisplayName: again
ThreadText: # kubernetes nodeport service load balancing
  
  (Asked by: username_0 on 2021-04-16)
  
  Let's assume I have three node named `n1`, `n2`, `n3`. created four pods named `p1`, `p2`, `p3`, `p4`, `k8s` scheduler placed pods in nodes as follows
  
  n1 -> p1
  
  n2 -> p2
  
  n3 -> p3, p4
  
  Now, to access these pods I have created a `nodeport` service. `Nodeport` service will open same numbered ports in each nodes. Nodes will have `iptables` configured to forward traffics from service to pods.
  
  Let's also assume that I will have a NLB configured top of it. how traffic will be distributed? is it like below?
  
  p1 -> 33.3330%
  
  p2 -> 33.3330%
  
  p3 -> 16.6665%
  
  p4 -> 16.6665%
  
  **Tags:** kubernetes, microservices
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-04-16. Score: 1
  
  `service` is a cluster-wide object. In each node, `kube-proxy` will create `iptable` load balancing entry with all available pod's IP based on selector for a `service`. So NLB will distributed traffic evenly among all nodes. Then each will loadbalance the traffic to all available pods using round robin algorithm.
  
  We will have those traffic distributed among all pods like below.
  
  p1 -> 33.3330%
  
  p2 -> 33.3330%
  
  p3 -> 16.6665%
  
  p4 -> 16.6665%
  
  This will deviate a little bit.
  
  
  ---
  
  