Sticky load balancing

Hi, I’m reading the documentation and on sticky load balancing it says “Consistent Hash-based load balancing can be used to provide soft session affinity based on HTTP headers, cookies or other properties. This load balancing policy is applicable only for HTTP connections. The affinity to a particular destination host will be lost when one or more hosts are added/removed from the destination service.”

Now I need some clarification here. I’m setting this up for gRPC, so I assume the HTTP connections part is fine.

I’m a bit worried about “affinity … will be lost when one or more hosts are added/removed from the destination service”. What exactly does “added/removed” mean here? Does that mean when one of the pods crashes, that all the stickiness will be lost (potentially missing all the caches and overloading the entire service)?

When any pods are added or removed from the service (even if its not the pod that you are stuck to), the sticky will reset. Example I had 5 pods running for a service and sticky set and my browser session was connecting to the same pod over and over as it should (sticky). When I delete one of the other pods my sticky session started over on another random pod. Why is it like this, idk.

@hickert33 i have 2 pods running and enabled sticky sessions using destinationrule using consistent hash lb, but i see traffic is flowing to 2 pods. Is there any other configuration i am missing on Ingress Gateway or virtualservice level ?

What field is your consistent-hash configured to hash? You need to make sure that field stay static for a user