ingress-nginx: Session affinity doesn't work for canaries

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.):

What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.): canary sticky session affinity


Is this a BUG REPORT or FEATURE REQUEST? (choose one):

BUG REPORT

NGINX Ingress controller version:

0.22.0

Kubernetes version (use kubectl version):

v1.5.4

Environment:

  • Cloud provider or hardware configuration: No cloud provider
  • OS (e.g. from /etc/os-release): Ubuntu 14.04.5 LTS, Trusty Tahr
  • Kernel (e.g. uname -a): Linux 4.9.16-040916-generic x86_64
  • Install tools:
  • Others:

What happened: According to the document, all non-canary annotations will be inherited from the main ingress, which I assume include the annotations for session affinity. My main ingress has following annotations:

kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/affinity: cookie
nginx.ingress.kubernetes.io/session-cookie-name: route
nginx.ingress.kubernetes.io/session-cookie-hash: sha1

and my canary ingress has following annotations:

kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-by-header: X-Canary

What’s happening is the route cookie is only added to the requests sent to the non-canary pool, not to the those sent to the canary pool, which causes session affinity to not work for the canary requests.

What you expected to happen: Session affinity works for canary ingresses.

How to reproduce it (as minimally and precisely as possible): Deploy a non-canary service with session affinity annotations, and its canary counterpart and set nginx.ingress.kubernetes.io/canary-weight: "100", send requests to the service, and you can see the session affinity cookie is not set.

Anything else we need to know:

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 35
  • Comments: 33 (15 by maintainers)

Most upvoted comments

yup.

/reopen

I’m also trying to setup canary testing with sticky sessions - any news on this??

Have the same issue (_)

Have the same issue(

I’m facing the exact same issue. Any updates on this?