Is there a load balancer policy which redirect requests to the same endpoint by IP address recognition in kubernetes?

6/18/2019

My actual configuration is the following: I'm using RKE to create my cluster. I'm using AWS servers as nodes in my clusters I have a cluster of 3 nodes and 3 pods (1 by node) deployed as statefulSet and a load balancer with thoses 3 pods as endpoints. This statefulSet execute a readiness probe, and then sometimes pods are not ready.

What I'm trying to do is to have a load balancer with the following policy:

Load balancer receive request from IP address A, it redirect it to endpoint X.

Load balancer receive a new request from IP address A, it redirect it to the same endpoint X.

Load balancer receive request from IP address B, it redirect it to endpoint Y.

Load balancer receive request from IP address A, but endpoint X not ready because of readiness test fail so it redirect request to endpoint Y.

-- yatsukino
amazon-web-services
kubernetes
load-balancing
rke

1 Answer

6/18/2019

I think most load balancers should be able to perform this task. For example, AWS ELB has a group attribute to enable sticky sessions (session that associate an IP with a specific server).

If you are using the alb-ingress-controller (for example) to create the Load Balancer from Kubernetes based on the ingress in Kubernetes, you can attach the following label to the alb-ingress-controller to define sticky sessions: alb.ingress.kubernetes.io/target-group-attributes: stickiness.enabled=true,stickiness.lb_cookie.duration_seconds=60.

I would validate your other requirements with regards to the Load Balancer as I think most known Load Balancers should have this capability.

-- Blokje5
Source: StackOverflow