1

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%

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.