# Global loadbalancer for public facing across multiple hosts

**URL:** <https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383>\
**Category:** General\
**Created:** [September 22, 2017, 3:59am UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383 "2017-09-22T03:59:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Htet\_Naing\_Aung](https://avatars.discourse-cdn.com/v4/letter/h/cdc98d/32.png) [@Htet\_Naing\_Aung](https://forums.suse.com/u/Htet_Naing_Aung)\
**Post date:** [September 22, 2017, 3:59am UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383/1 "2017-09-22T03:59:37Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![cjellick](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/cjellick/32/2876_2.png) [@cjellick](https://forums.suse.com/u/cjellick)\
**Post date:** [September 22, 2017, 4:24pm UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383/2 "2017-09-22T16:24:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Htet\_Naing\_Aung](https://avatars.discourse-cdn.com/v4/letter/h/cdc98d/32.png) [@Htet\_Naing\_Aung](https://forums.suse.com/u/Htet_Naing_Aung)\
**Post date:** [September 23, 2017, 1:02pm UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383/3 "2017-09-23T13:02:18Z")

</div>

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](http://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!

---

<div class="post-metadata">

**Author:** ![cjellick](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/cjellick/32/2876_2.png) [@cjellick](https://forums.suse.com/u/cjellick)\
**Post date:** [September 26, 2017, 5:01pm UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383/4 "2017-09-26T17:01:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Htet\_Naing\_Aung](https://avatars.discourse-cdn.com/v4/letter/h/cdc98d/32.png) [@Htet\_Naing\_Aung](https://forums.suse.com/u/Htet_Naing_Aung)\
**Post date:** [October 1, 2017, 9:36am UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383/5 "2017-10-01T09:36:13Z")

</div>

The balancer deployed without facing any issue but the rule inside the balancer doesn’t work.

---

<div class="post-metadata">

**Author:** ![Htet\_Naing\_Aung](https://avatars.discourse-cdn.com/v4/letter/h/cdc98d/32.png) [@Htet\_Naing\_Aung](https://forums.suse.com/u/Htet_Naing_Aung)\
**Post date:** [October 2, 2017, 1:39am UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383/6 "2017-10-02T01:39:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cjellick](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/cjellick/32/2876_2.png) [@cjellick](https://forums.suse.com/u/cjellick)\
**Post date:** [October 6, 2017, 5:16pm UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383/7 "2017-10-06T17:16:28Z")

</div>

Can you post the docker/rancher compose files for your services (including the LB)?

---

<div class="post-metadata">

**Author:** ![Htet\_Naing\_Aung](https://avatars.discourse-cdn.com/v4/letter/h/cdc98d/32.png) [@Htet\_Naing\_Aung](https://forums.suse.com/u/Htet_Naing_Aung)\
**Post date:** [October 26, 2017, 1:10am UTC](https://forums.suse.com/t/global-loadbalancer-for-public-facing-across-multiple-hosts/7383/8 "2017-10-26T01:10:39Z")

</div>

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](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
