<p>We are looking into using Docker plus either Mesos/Marathon or Kubernetes for hosting a cluster.  However, the one issue that we haven't really seen any answers for is how to allow clustered services to connect to each other correctly.  All of the ones that I have seen need to know about at least one other node before they can join the cluster.   Some need to know about every node.  However, in Kubernetes and Mesos, there's no way to know what those IP addresses are ahead of time.</p>

<p>So, are there any best practices for this?  If it helps, some technologies we're looking into deploying as containers are ElasticSearch, ActiveMQ, and MongoDB.  There may be others.</p>

<blockquote>
  <p>However, the one issue that we haven't really seen any answers for is how to allow clustered services to connect to each other correctly.</p>
</blockquote>

<p>I think you're talking about HA/replicated/sharded apps here.</p>

<p>At the moment, in kubernetes, you can accomplish this by making an api call listing all the "endpoints" of the service; that will tell you where your peers are running.</p>

<p>We'd eventually like to support the use case you describe in a more first-class manner.</p>

<p>I filed <a href="https://github.com/GoogleCloudPlatform/kubernetes/issues/3419" rel="nofollow">https://github.com/GoogleCloudPlatform/kubernetes/issues/3419</a> to maybe get something more standardized started here.</p>
