<p>I have gone through the doc mentioned here <a href="https://github.com/kubernetes/dns/blob/master/docs/specification.md" rel="nofollow noreferrer">gitlink</a> as well as <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">doclink</a></p>
<p>But my job would be a whole lot easier if I could get the dns of a resource type by using any kubernetes command.
Also tried this <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run" rel="nofollow noreferrer">commands-link</a></p>
<p>For example, i would like to get the dns name of a service <code>db-service</code> running in <code>dev</code> namespace inside <code>svc.cluster.local</code></p>
<pre class="lang-sh prettyprint-override"><code>db-service.dev.svc.cluster.local
</code></pre>
<p>Any pointers ?</p>

codeaprendiz
<p>If you need to, you can query that in a pod:</p>
<p><a href="https://stackoverflow.com/questions/44712874/how-do-i-run-a-container-from-the-command-line-in-kubernetes-like-docker-run">How do I run a container from the command line in Kubernetes (like docker run)?</a></p>
<p><a href="https://stackoverflow.com/questions/59559438/retrieve-the-full-name-of-a-service-in-kubernetes">Retrieve the full name of a service in Kubernetes</a></p>
<p>using a pod which has some DNS utils</p>
<pre><code>kubectl run tmp-shell --rm -i --tty --image tutum/dnsutils -- /bin/bash
</code></pre>
<p>you can then run</p>
<pre><code>root@tmp-shell:/# nslookup db-service
Server:     10.2.32.10
Address:    10.2.32.10#53

Name:   db-service.dev.svc.cluster.local
</code></pre>
<p>for a one-liner, see: <a href="https://serverfault.com/questions/929211/kubernetes-pod-dns-resolution">https://serverfault.com/questions/929211/kubernetes-pod-dns-resolution</a></p>
