<p>How do I use minikube's (cluster's) DNS? I want to receive all IP addresses associated with all pods for selected headless service? I don’t want to expose it outside the cluster. I am currently creating back-end layer.</p>

<p>As stated in the following answer: 
<a href="https://stackoverflow.com/questions/52707840/what-exactly-is-a-headless-service-what-does-it-do-accomplish-and-what-are-som/52713482">What exactly is a headless service, what does it do/accomplish, and what are some legitimate use cases for it?</a></p>

<p><em>„Instead of returning a single DNS A record, the DNS server will return multiple A records for the service, each pointing to the IP of an individual pod backing the service at that moment.”</em></p>

<p>Thus the pods in back-end layer can communicate to each other.</p>

<p>I can’t use dig command. It is not installed in minikube. Eventually how do I install it? There is no apt available.</p>

<p>I hope this explains more accurately what I want to achieve.</p>

hal
<p>You mentioned that you want to receive IP addresses associated with pods for selected service name for testing how does headless service work.</p>

<p>For only testing purposes you can use port-forwarding. You can forward traffic from your local machine to dns pod in your cluster. To do this, you need to run:</p>

<pre><code>kubectl port-forward svc/kube-dns -n kube-system 5353:53
</code></pre>

<p>and it will expose kubs-dns service on your host. Then all you need is to use <code>dig</code> command (or alternative) to query the dns server.</p>

<pre><code>dig @127.0.0.1 -p 5353 +tcp +short &lt;service&gt;.&lt;namespace&gt;.svc.cluster.local
</code></pre>

<p>You can also test your dns from inside of cluster e.g. by running a pod with interactive shell:</p>

<pre><code>kubectl run --image tutum/dnsutils dns -it --rm -- bash
root@dns:/# dig +search &lt;service&gt;
</code></pre>

<p>Let me know it it helped.</p>
