How to set session affinity between inner servicess inside a Kubernetes cluster
Natively Kubernetes itself does not provide session affinity
on service [concept] level.
The only way that comes to my mind is to use Istio and it's Destination Rules
. Taken from the istio manual:
DestinationRule
defines policies that apply to traffic intended for a service after routing has occurred. These rules specify configuration for load balancing, connection pool size from the sidecar, and outlier detection settings to detect and evict unhealthy hosts from the load balancing pool.
This document shows how to to configure sticky session
with istio.