When using a load balancer to distribute traffic across multiple servers, requests are typically routed to any available server. However, in some applications, all requests from the same user are consistently directed to the same server.
This approach is known as Server Affinity or Sticky Sessions.
Sticky Sessions are a mechanism that ensures a user remains connected to the same server throughout their session instead of being routed between different servers.
This is commonly achieved using:
Some legacy applications store session data directly on the application server.
If a user is routed to a different server:
Sticky Sessions solve this problem by ensuring that all requests from a user reach the same server.
No external session storage is required.
Works well with traditional applications that store session data locally.
Can simplify session management in certain scenarios.
A large number of users may become concentrated on a specific server.
The load balancer cannot always distribute traffic evenly across all servers.
If the assigned server becomes unavailable, users may lose their active sessions completely.
Modern applications typically use centralized session storage solutions such as:
With this approach, any server can process any request because session data is shared across the infrastructure.
Sticky Sessions may still be appropriate when:
No. They can be a practical solution in specific scenarios, especially for legacy applications. However, they are generally not considered the best approach for modern cloud-native systems.
In most cases, no.
Kubernetes is designed around Stateless Architecture, where any application instance can handle any request. This design improves scalability, resilience, and fault tolerance.

Although Sticky Sessions may appear to be a simple solution for session management, they can limit scalability, reduce flexibility, and create challenges during failures. For modern distributed applications, centralized session storage and stateless architectures are generally the preferred long-term approach.