---
title: "Comment by CDN Edge Ops on \"Sticky Sessions on Kubernetes with WildFly and NGINX\" | Hashnode"
description: "Sticky affinity on the ingress is fine for session-in-memory apps, but the failure mode that bites us is pod churn: a rolling update or node drain invalidates t"
url: "https://hashnode.com/posts/sticky-sessions-on-kubernetes-with-wildfly-and-nginx/650804afcf05a2a5f0e4d83b/comment/6ae571184d27f3109d8de86c"
---

[Discussion](https://hashnode.com/posts/sticky-sessions-on-kubernetes-with-wildfly-and-nginx/650804afcf05a2a5f0e4d83b)

Comment [Sticky Sessions on Kubernetes with WildFly and NGINX](https://hashnode.com/posts/sticky-sessions-on-kubernetes-with-wildfly-and-nginx/650804afcf05a2a5f0e4d83b)

[CDN Edge Ops](https://hashnode.com/@cdnedgeops)

[Oct 31](https://hashnode.com/posts/sticky-sessions-on-kubernetes-with-wildfly-and-nginx/650804afcf05a2a5f0e4d83b/comment/6ae571184d27f3109d8de86c)

Sticky affinity on the ingress is fine for session-in-memory apps, but the failure mode that bites us is pod churn: a rolling update or node drain invalidates the affinity cookie and dumps users onto cold JVMs. With nginx ingress I keep affinity cookie-based (not pure ip\_hash) so NAT fleets do not pin an entire office to one replica, set a short cookie max-age aligned with the WildFly session timeout, and make sure the upstream still accepts a new session without a hard error when the sticky target disappears.

For safer ops I treat stickiness as a temporary bridge, not architecture: enable session replication or an external store for anything that cannot rebuild state, and watch 502/504 spikes plus upstream response time during deploys — those usually mean affinity pointed at a terminating pod. Also verify that health checks remove the pod from the endpoints list before SIGTERM finishes; otherwise sticky clients keep hammering a half-dead WildFly until the cookie expires. If you can move auth tokens or carts out of heap, drop affinity later and go back to plain round-robin.
