Ways to link all containers in the same scaling group/service

Hi, I am trying to setup an Elastic Search service in Rancher, and I am having troubles getting the containers within the same scaling group to be on the same internal network with all ports exposed so that the elastic search nodes can auto-discover each other and form a proper cluster.

Any ideas? I did not see anything in the UI to do this.

Thani you in advance!

Sébastien Arnaud

1 Like

I don’t see it in their docs anywhere obvious, but I believe the default discovery is layer 2 broadcast/multicast-based. The Rancher overlay network is layer 3, so there is not a contiguous layer 2 broadcast domain between the containers.

There are plugins for AWS, GCE, Azure, etc linked in their docs. These don’t help directly but we are currently working on adding an “introspection API” that would let a container look up information about itself and the service it is a member of. Without knowing anything specific about it, I would expect it would be easy to use that in an ElasticSearch plugin to provide the info it needs about adjacent containers in the cluster.

Thank you @vincent! This explains a lot.

I did notice that if I link manually several individual Elastic Search services, I am able to get the nodes to auto discover and form the cluster. Which is why my question was if the containers within a same service are automatically exposing their available docker ports to each other.

All the containers within an environment can reach each other… your ElasticSearch containers just have no way to know what each other’s IPs are without linking or that introspective API that isn’t out yet.

In the latest release you can actually link a single ElasticSearch service (with e.g. scale=5) to itself by editing it after create. Let’s say you give it an “as name” of “cluster”, then from any of the containers you can lookup “cluster” in DNS. That will give you back 5 A records with the 10.42.x.x for the 5 containers in that service.

It’s possible ElasticSearch is smart enough to be able to lookup a hostname and use the 5 records that it gets back. That would be convenient :-). Otherwise you’d be back to creating a plugin, startup script, or config file to get them into ES, but at lest it’s possible to get the IPs today.

1 Like

Thank @vincent I get it now.

Cheers!