Hi there!
I have a project I’m deploying using rancher-compose
it basically have one container and one load balancer my infra consist on 3 hosts each of them in different regions (us-west, us-east and eu-west). When deploying I deploy with io.rancher.scheduler.global: true
label for both my app container and my load balancer container and I get what I want one container of each on each of the host in different regions.
So this is my question: How can I do to force each of those load balancers to just redirect to the app container that it’s on the same region than the load balancer?
This is how my docker-compose.yml
file looks like:
app:
image: myregistry.com/mynamespace/myapp:latest
env_file: .env
labels:
io.rancher.container.pull_image: always
io.rancher.scheduler.global: true
io.rancher.scheduler.affinity:host_label: environment=production,application=myapp
stdin_open: true
lb:
image: rancher/load-balancer-service
ports:
- 443:80
links:
- app:app
labels:
myapp.lb: 1
io.rancher.scheduler.global: true
io.rancher.loadbalancer.ssl.ports: '443'
io.rancher.scheduler.affinity:host_label: environment=production,application=myapp
stdin_open: true
At the minute the load balancer redirect to any of the containers as I think it’s just not aware of the regions, what I’m trying to avoid here it’s lag between those call so if someone from us west coast request my app it should be querying my host/container from us west.
Thanks