Home > OS >  LoadBalancing done by Service or IngressController in kubernetes?
LoadBalancing done by Service or IngressController in kubernetes?

Time:07-08

As per my understanding

  1. Ingress maintains set of rules like which path to which service.
  2. IngressController handles the request to service based on rules specified in Ingress.
  3. Service is pointing to several pods by label selectors. The request is handled to any of the pod under the service.

Now I want to add sticky session to one of the Service “auth-service”. I want requests from one user to reach same pod.

My Service is clusterIP. IngressController is AWS Load balancer.

If my understanding is correct, I should add sticky session to service.(is it correct). But when I google, different places show i can add to Ingress or IngressController.

I want to know where to apply the sticky session and how to do it?

If it is to be applied on IngressController or Ingress, how service will use that to route the req to the POD?

Thanks in advance.

CodePudding user response:

You should add sticky session annotations to Ingress Resource

once we configure session affinity for our ingress, it will respond to the request with set-cookie header set by the ingress-controller. The randomly generated cookie id will be mapped to served pod so that flow of all requests will serve by the same server

CodePudding user response:

You also need to set proxy protocol at LB to capture the client ip and annotations at ingress.

  • Related