Rancher Load Balancer labels for sticky sessions?

I have a stack that requires session persistence at the Tomcat layer, and I’d like to front-end it with the built-in Rancher load balancer (HAproxy). Right now, my docker-compose.yml file has this entry for the load balancer:

lb:
labels:
io.rancher.scheduler.global: 'true’
io.rancher.loadbalancer.ssl.ports: '443’
image: rancher/load-balancer-service
links:
- hybris
ports:
- 80:9001
- 443:9002

Are there any labels I can use to specify sticky sessions, including a cookie name, etc? The labels for rancher loadbalancer don’t seem to be documented well. I’m able to manually add a service if I deploy without the load balancer, but if I deploy the stack using rancher-compose, then I’m unable to modify session stickiness settings after the fact.

Anyone? I suppose without official support for session persistence through compose, we will be stuck manually deploying Rancher load balancers for the time being.

You can add stickiness in a rancher-compose.yml.

I would recommend using the UI to see the stickiness options. Then you can click on the stack name and click on “View Config” of the stack to see the related rancher-compose.yml options.

Great idea, Denise; I didn’t think to look at the configuration generated. By the way, in case anyone is interested in how to do this, in rancher-compose.yml, my load balancer service looks like this:

lb:
load_balancer_config:
lb_cookie_stickiness_policy:
cookie: persistencecookie
domain: stacks.space
haproxy_config: {}
default_cert: stacks.space
health_check:
port: 42
interval: 2000
unhealthy_threshold: 3
healthy_threshold: 2
response_timeout: 2000