nginx can't implement session stickiness with nodeport services, must be clusterip?

Sergey A. Osokin osa at freebsd.org.ru
Wed Mar 13 21:03:11 UTC 2024


Hi David,

On Fri, Mar 08, 2024 at 11:18:10AM -0800, David Karr wrote:
> I maintain the Java side of a platform that supports a couple of hundred
> services running in a number of k8s clusters.  Each pod has a container
> running the Java process, and a container running nginx, as a proxy to the
> Java service. All the k8s service objects are type NodePort, not ClusterIP.
> 
> I don't know a lot about nginx, we consider it mostly a blackbox.

How's nginx configured there?  Is it L7 or L4 reverse proxy?

> We have one service that unfortunately requires session stickiness.

The "session persistense" feature avaialable with NGINX Plus product,
[1].

> I am being told that we have to change the service type for this service
> to ClusterIP, because, and I quote the person who told me this:
> 
>     "Nginx needs to be able to read the "endpoint" objects off of the
> service. For some reason, that's not possible with NodePorts, but works
> fine with ClusterIPs."
> 
> Does this make sense to anyone here? Can someone explain why this might be?

That's a bit unclear to me, so that needs to get more details
about the current solution.

Thank you.

References
----------
1. https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/#enabling-session-persistence

-- 
Sergey A. Osokin


More information about the nginx mailing list