Kubernetes service pointing to specific instance of ReplicaSet Kubernetes service pointing to specific instance of ReplicaSet kubernetes kubernetes

Kubernetes service pointing to specific instance of ReplicaSet


Assuming http based cookies something that are looking for you can use ingress controller and so called sticky sessions / session affinity.

The ingress controller replies the response with a Set-Cookie headerto the first request. The value of the cookie will map to a specificpod replica. When the subsequent request come back again, the clientbrowser will attach the cookie and the ingress controller is thereforeable to route the traffic to the same pod replica.

Basically by setting appropriate annotations in the ingress object, you will make sure the subsequent traffic request will still be sent to the same pod.

Nginx has a good example and documentation about those.

Alternatively you can also use traefik as ingress controllers. It also supports sitcky session (they`re just defined not at ingress level but traefik's ingressroute).