Canary Ingress weight with cookie in response for sticky session #6925
itsstefanpopov
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We had an idea to implement canary deployments while using sticky session so, for instance, 20% of our traffic uses canary while the others use 80%, all the while these requests stick with the initial behaviour, meaning if a request went to the canary deployment the first time, we want it there again and again.
Now I have tried setting this by using the file attached below, as the session-cookie-name should write a cookie in the response (i.e. enabling the stickiness) and the canary annotations should just recognize the cookie set before, while the weight is set to 20 so that at first we have 20% of the traffic routed to the canary
`apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: test
annotations:
name: ingress-echo
spec:
ingressClassName: nginx
rules:
- host: canary.example.com
http:
paths:
- path: /echo
pathType: Exact
backend:
service:
name: echo-v1
port:
number: 8080
tls:
secretName: ingress-echo-tls
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: test
annotations:
nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "http-cookie"
nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-weight: "20"
name: ingress-echo-canary-cookie
spec:
ingressClassName: nginx
rules:
- host: canary.example.com
http:
paths:
- path: /echo
pathType: Exact
backend:
service:
name: echo-v2
port:
number: 8080
tls:
secretName: ingress-echo-canary-cookie-tls`
Beta Was this translation helpful? Give feedback.
All reactions