0

I am running nginx as an ingress controller for my Kubernetes cluster and I have a use case where I am using cookie affinity to persist the client to a specific pod for session purpose.

I am using the following annotation:

nginx.ingress.kubernetes.io/affinity: cookie

This will cause the nginx controller to reply with a Set-Cookie header that can be re-used by the client.

set-cookie: INGRESSCOOKIE=1657803129.789.928.252486|33fc3ff8c889180479b242584ba1f3ad

I would however like to have the nginx controller to use consistent hashing on URI if the client is not sending the cookie itself without having to use an other ingress.

Is this something that can be configured with nginx ingress controller? It seems that

nginx.ingress.kubernetes.io/upstream-hash-by: "$request_uri" and nginx.ingress.kubernetes.io/affinity: cookie are mutually exclusive.

I have seen NGINX load balancing hash: use cookie value if present, ip_hash if not but it does not seem to be applicable when using the nginx annotations.

Dave M
  • 4,494
  • 21
  • 30
  • 30
Virtuose
  • 537
  • 1
  • 6
  • 11

0 Answers0