Interview Prep/Kubernetes/Services, Ingress and DNS

Session stickiness is required for a legacy app. What are the options?

IntermediateScenarioServices, Ingress and DNS
Answer

Situation read → A stateful web app breaks when requests bounce between pods.

What I'd do →

  1. Use sessionAffinity: ClientIP on the Service with sessionAffinityConfig.clientIP.timeoutSeconds
  2. Prefer ingress cookie affinity such as nginx.ingress.kubernetes.io/affinity: cookie
  3. With ALB use target group stickiness annotations
  4. Plan to externalise the session to Redis, which is the real fix
  5. Test with several clients behind NAT

Why → ClientIP affinity is weak behind NAT or proxies, because many users share one source IP.

Interview tip → Say you treat stickiness as a stop-gap and push for stateless sessions.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Ingress and DNS