Hi Everyone!,
In the rancher environment, it’s working properly when we setup loadbalancers on each hosts.
Let’s say, we have 3 hosts (Host A, Host B & Host C). Every single host have their own loadbalancers (3 LBs).
Web application container running on top of Host A might be pass through Host A - LB. It can’t pass through via Host B because I used route53 for external DNS service and set dns host label for each host.
My question is that how can I setup single global loadbalancer across multiple hosts ? Means that I would like to setup just only one loadbalancer (public facing + SSL termination) on Host D and the applications running on top of Host A,B & C can pass through this loadbalancer properly. Is it possible or not ?
When I research by googling, I found some scenarios and it didn’t work because they setup in single host.
Any idea how I can do this ? Thanks in advance
I don’t quite understand your problem. I would just create a load balancer service with scale 1 and use scheduling rules to force it to host D and then configure it for my services.
Is that what you want to do or am I missing some nuance?
When we use route53 external DNS service, we need to set host lablel (io.rancher.host.external_dns_ip) on each rancher host. I understood that we can also use this host label with public IP address for scheduling to launch the application and loadbalancer on exact host.
Here is my questions.
- Host A have redmine application with private port 3000
- Host B have java application with private port 8080
It’s fine when we create loadbalancer on each host. As I mentioned above,the loadbalancer will pick up the exact host (Host A) by setting host label in the scheduling. Then, we can call “redmine” application from outside world without adding this application port ( e.g redmine.example.com )
Host B application will be the same scenario. “java” application will pass through via Host B loadbalancer.
I would like to setup Host D as a loadbalancer for Host A & Host B applications. When I create loadbalancer for “redmine” and “java” application on Host D and set host label in the scheduling to pick up Host D, it doesn’t work.
Is it possible to setup like this scenario ? Please kindly suggest me.
Thanks!
What do you mean by “it doesn’t work”? Does it fail to deploy? Get deployed elsewher? The balancer deploys but doesn’t balance traffic properly?
The balancer deployed without facing any issue but the rule inside the balancer doesn’t work.
But it’s working properly when I deploy the balancer and application on the same host.
When the balancer and application were running on separate host,it doesn’t work. It means that application is running on top of Host A and the balancer is running on top of Host D.
Can you post the docker/rancher compose files for your services (including the LB)?
java-01 is running on top of Host-02 and LB run on Host-03.
It doesn’t work. Please check as follow.
docker-compose.yml
version: '2’
services:
lb-01:
image: rancher/lb-service-haproxy:v0.7.9
ports:
- 80:80/tcp
labels:
io.rancher.scheduler.affinity:host_label: coreos-03=lb
io.rancher.container.agent.role: environmentAdmin
io.rancher.container.create_agent: 'true’
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
rancher-compose.yml
version: '2’
services:
lb-01:
scale: 1
start_on_create: true
lb_config:
certs: []
port_rules:
- hostname: http://dev.java-01.13mesh.com
priority: 1
protocol: http
service: web-app/java-01
source_port: 80
target_port: 8080
health_check:
response_timeout: 2000
healthy_threshold: 2
port: 42
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
reinitializing_timeout: 60000