[SOLVED] Loadbalancing HowTo

Problem:
Loadbalancer only ever outputs 503

Background:
a single node rancher accessible like this:

sub.domain:8080

with a LAN IP 141…

resolv.conf:

nameserver 141...
nameserver 141...
nameserver 141...

which gets reset by dhcp or something.

hosts

127.0.0.1 localhost ... sub sub.domain 141...

I can deploy containers with i.e. 1000:8080 which get IP addresses 10… on my localhost 172…

curl -i sub.domain:1000
... OK

Steps to reproduce:
create an HAProxy in UI

Public    HTTP    [request host empty] :80 [path empty for now] container 1000

Result:

curl -i sub.domain:1000
... OK

curl -i sub.domain:80
503

From posts I’ve read elsewhere I suspect this has something to do with HAProxy not finding an internal DNS? Where can I find help debugging this? Where should I put which IP for it to know what I want?

after

 dig sub.domain:80

indeed showed the 141 nameservers, I moved the lb to the same stack as the container. This enabled the LB to properly lookup the container.

To do URL path based balancing (reverse proxying), I need an LB to properly resolve all stacks. How can this be achieved? Should I move all containers into the same stack?

EDIT: I found my solution:

In the stack of the load balancer, create a service alias to the container in the other stack.
in the load balancer, target that service WITH THE INTERNAL PORT of the link destination container.

Except for the public port of the destination container not working with the alias, this is a breeze. Now it is documented at least here.