How does LoadBalancer forward traffic to the target service?

3/30/2019

Does LoadBalancer use kube-proxy as mentioned in this article or is it using NodePort as mentioned here?

If it's in fact using NodePort, then why are multiple sources such as MetalLB claiming that using NodePort in production is not a good idea?

Ingress also operates using NodePort + nginx. What's so special about LoadBalancer then?

-- d9ngle
kubernetes

1 Answer

3/30/2019

It depends on the cloud provider implementation:

Traffic from the external load balancer will be directed at the backend Pods, though exactly how that works depends on the cloud provider.

https://kubernetes.io/docs/concepts/services-networking/#loadbalancer

In case of Google Kubernetes Engine (GKE), this is how it works:

When using the external load balancer, arriving traffic is initially routed to a node using a forwarding rule associated with the GCP network. After the traffic reaches the node, the node uses its iptables NAT table to choose a Pod. kube-proxy manages the iptables rules on the node.

-- almalki
Source: StackOverflow