I'm experimenting with Consul, Rancher and Docker.
So I have this REST service that runs on 4 different hosts. each instance of this service register itself in a single Consul container using container linking. that is, all instances know about the Consul container.
This works fine.
What doesnt work fine is when Consul tries to do health checks to my services. If an instance of the service runs on the same host as the consul container, that works. But any instance running on a different host will fail. Address unrachable.
I have tried to extract the service instance container IP in a few different ways. 1) listing all available notwork interfaces and ip's inside the container. 2) "hostname -i" inside the container.
They all yeild IPs. e.g. 172.16.0.06
While Rancher list IP's such as 10.43.100.24
for the same container.
My guess is that Consul should perform the health check on the IP that Rancher shows, and not the IP that I extracted inside the container.
I'm a bit at loss here, How should my service find the IP that it should use to register itself inside Consul?
(I'm aware that this is not really how Consul should be used, but the problem is that containers on one host can not reach containers on another host.. so the Consul part is just to put context on what I'm trying out)