<p>I am new to Kubernetes, and I am trying to make inter-pod communication over DNS to work. </p>

<p>Pods in My k8s are spawned using Deployments. My problem is all the Pods report its hostname to Zookeeper, and pods use those hostnames found in Zookeeper to ping the other peers. It always fail because the peer's hostnames are unresolvable between pods.</p>

<p>The only solution now is to manually add each pod's hostname to peer's /etc/hosts file. But this method would not endure to work for large clusters. </p>

<p>If there is a DNS solution for inter-pod communication, that keeps a record of any newly generated pods, and delete dead pods, will be great. </p>

<p>Thanks in advance.</p>

Minera Fanhiri
<p>One solution I had found was to add <code>hostname</code> and <code>subdomain</code> under <code>spec-&gt;template-&gt;spec-&gt;</code> , then the communication over hostnames between each pod is successful. </p>

<p>However, this solution is fairly dumb, because I cannot set the <code>replicas</code> for each Deployment to more than 1, or I will get more than 1 pod with same hostname in the cluster. If I have 10 slave nodes with same function in a cluster, I will need to create 10 Deployments.</p>

<p>Any better solutions?  </p>
