# Load balancer Randomize port issue

**URL:** https://forums.suse.com/t/load-balancer-randomize-port-issue/4877
**Category:** Rancher 1.x
**Created:** [December 12, 2016, 9:32am UTC](https://forums.suse.com/t/load-balancer-randomize-port-issue/4877 "2016-12-12T09:32:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![noamkachko](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@noamkachko](https://forums.suse.com/u/noamkachko)
#### Post date: [December 12, 2016, 9:32am UTC](https://forums.suse.com/t/load-balancer-randomize-port-issue/4877/1 "2016-12-12T09:32:01Z")

</div>

Hi  
we are using rancher as dev environment . developers can start stacks we created that contains cluster of 2 nodes and LB over some predefined machine pool of Ubuntu 16.04 docker 1.12.3.  
we are currently doing poc of moving to rancher 1.2 but we noticed that the option to randomize external port in the LB was gone from docs . we tried to play with it but this use case that worked in rancher 1.1.3 is not working any more .  
can you please advice ?  
Thanks!

---

<div class="post-metadata">

### Author: ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)
#### Post date: [December 13, 2016, 6:32am UTC](https://forums.suse.com/t/load-balancer-randomize-port-issue/4877/2 "2016-12-13T06:32:42Z")

</div>

This should still work the same in compose and API; the balancer is essentially a regular service.

---

<div class="post-metadata">

### Author: ![noamkachko](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@noamkachko](https://forums.suse.com/u/noamkachko)
#### Post date: [December 13, 2016, 8:37am UTC](https://forums.suse.com/t/load-balancer-randomize-port-issue/4877/3 "2016-12-13T08:37:16Z")

</div>

Hi  
the definition bellow worked in previous version(without the version 2 syntax) but now i see that the request is not routed to the connected services on port 8080 .  
i also see in that in haproxy.cfg  
those lines are missing:

frontend 39836b06-dd79-4875-a428-d8f2f318b275\_49960\_frontend  
bind \*:49960  
mode http

```
    default_backend 39836b06-dd79-4875-a428-d8f2f318b275_49960_0_backend

```

backend 39836b06-dd79-4875-a428-d8f2f318b275\_49960\_0\_backend  
mode http  
timeout check 2000  
option httpchk GET /status HTTP/1.0  
server 133ac75f-8e8a-4f5e-968c-372280ffc2fa 10.42.246.170:8080 check port 8080 rise 2 fall 3  
server a972ccc8-01fd-4a8a-9c29-df21df5b5ec8 10.42.157.81:8080 check port  
8080 rise 2 fall 3  
http-request set-header X-Forwarded-Port %[dst\_port]

Example :  
Docker compose:  
version: '2’  
services:  
lb:  
image: rancher/lb-service-haproxy  
stdin\_open: true  
tty: true  
links:  
- s2:s2  
- s1:s1  
ports:  
- 57651:8080/tcp  
labels:  
io.rancher.container.agent.role: environmentAdmin  
io.rancher.container.create\_agent: 'true’  
s1:  
image: image1  
ports:  
- 62553:8080/tcp  
- 59586:5701/tcp  
s2:  
image: image2  
ports:  
- 64023:8080/tcp  
- 62320:5701/tcp

Rancher Compose:  
version: '2’  
services:  
lb:  
scale: 1  
health\_check:  
port: 42  
interval: 2000  
unhealthy\_threshold: 3  
healthy\_threshold: 2  
response\_timeout: 2000  
s2:  
scale: 1  
health\_check:  
port: 8080  
request\_line: GET /status HTTP/1.0  
unhealthy\_threshold: 3  
healthy\_threshold: 2  
response\_timeout: 2000  
s1:  
scale: 1  
health\_check:  
port: 8080  
request\_line: GET /status HTTP/1.0  
unhealthy\_threshold: 3  
healthy\_threshold: 2  
response\_timeout: 2000

the ports that i stated in the docker compose are indeed randomized by rancher as you stated but the routing from the load balancer to the services does not work. although i stated the links in the docker compose what am i missing ?

Thanks!

Thanks!
