Why the NodePort is not LoadBalancer?

3/30/2019

I read a lot of document that the NodePort is not LoadBalancer. But in practice it LoadBlance traffic between different pods in different nodes and so we can call it LoadBalancer. so why we could not use NodePort as LoadBalancer?

-- yasin lachini
kubernetes

1 Answer

3/30/2019

LoadBalancer type services are a combo of a NodePort service and a cloud load balancer in front of it. NodePort services are an incomplete solution in most cases because there isn't a great way to get packets from the client to where they need to go. Yes there is a port open on every node, but how does that get used? You can use a NodePort and a DNS round-robin approach in some cases, but most protocols don't work very well in that mode. For example, if one node went down, it might still be in DNS caches so clients would usually still try and reach it even if other nodes in the DNS record are still up. Additionally there are protocol limits on how many IPs can be returned for a single record. The LoadBalancer type puts a single floating virtual IP (VIP) in front of all those NodePorts, usually via a public cloud system like AWS CLBs or GCP TCP load balancers, but there are more direct tools like MetalLB too.

-- coderanger
Source: StackOverflow