EKS provisioned LoadBalancers reference all nodes in the cluster. If the pods reside on 1 or 2 nodes is this efficient as the ELB traffic increases?

6/9/2020

In Kubernetes (on AWS EKS) when I create a service of type LoadBalancer the resultant EC2 LoadBalancer is associated with all nodes (instances) in the EKS cluster even though the selector in the service will only find the pods running on 1 or 2 of these nodes (ie. a much smaller subset of nodes). I am keen to understand is this will be efficient as the volume of traffic increases.

I could not find any advice on this topic and am keen to understand if this the correct approach.

-- NickB
amazon-eks
kubernetes

2 Answers

6/14/2020

On EKS, if you are using AWS CNI, which is default for EKS, then you can use aws-alb-ingress-loadbalancer to create ELB & ALB.

While creating loadbalancer you can use below annotation, then traffic is only routed to your pods.

alb.ingress.kubernetes.io/target-type: ip

Reference:

-- Sumit Murari
Source: StackOverflow

6/10/2020

This could introduce additional SNAT if the request arrives at the node which the pods is not running on and also does not preserve the source IP of the request. You can change externalTrafficPolicy to Local which only associates nodes have pods running to the LoadBalancers.

You can get more information from the following links.

Perserve source IP

EKS load balancer support

-- Hang Du
Source: StackOverflow