Just trying to get my head around a few things as fairly new to rancher / docker.
Say for instance I have an app with a front end and a back end api and I am running multiple instances of the api across a few hosts, whats the best way to point the front end to the api?
I have tried it with service linking which seems to work but I don’t understand what its doing in the background. If I link a service that has multiple containers across multiple hosts does it act as a load balancer?
Should I just set up an internal load balancer and link to that as a service?
When you link two services, rancher updates its DNS to include the linked to service with the addresses of all instances. So when you query the DNS you get the all the IP addresses for that service.
Not exactly sure if they do some kind of round robin on the addresses returned, though.
All the addresses are returned, in an order that is randomized every time it is requested. Depending on the client application they may use all of them, pick the first one, a random one, there one most closely matching their subnet, etc. So it sort of acts like a “poor-man’s” balancer. If you need more control then you can create an internal balancer.