Switching off sticky sessions in Openshift routes
I had some trouble a while ago implementing a canary deployment using internal scaling.
When I started calling the route, I noticed that all requests were being served from the same pod.
Obviously this was caused by sticky sessions.
How do you switch them off ?
It's quite simple in Openshift Routes using annotations.
The annotations in question are
haproxy.router.openshift.io/balance
haproxy.router.openshift.io/disable_cookiesWhat these do are change the balancing strategy for the openshift route to roundrobin, which will randomise the pod that receives your request, and disable cookies from the router, so they cannot set a cookie which dictates which pod should receive your request.
You can switch off the sticky sessions by running
oc annotate routes myroute haproxy.router.openshift.io/disable_cookies='true'
oc annotate routes myroute haproxy.router.openshift.io/balance='roundrobin'
May your requests be ever spread [...]
Cheers