
Pods can be transitory and sticky routing is best-effort basis
It is important to remember that Kubernetes pods and nodes can be short lived and can be re-scheduled due to external events. It is not advised to put any critical stateful logic in Services.Considering this, sticky routing is best effort basis. In the event of a pinned pod getting deleted / evicted, all sessions pinned to that pod will be re-assigned randomly to other pods. Similarly, in the event of a scale up or scale down, the sessions might be re-assigned to evenly distribute the load.Enabling Sticky Routing
To enable sticky routing, first in the Servicelabels
section add a special
label tfy_sticky_session_header_name
and add a header name against it. For e.g. x-truefoundry-sticky-session-id

Sticky Routing from UI
Passing the header when making requests
Now, your clients can send this header with a unique value for a “session”. For e.g. this value can be a conversation id or user id, anything that identifies a unique session that can benefit from stickyness. For e.g.x-truefoundry-sticky-session-id: session-id-qnfjk
will be routed to the same pod the first request was routed to.