<p>By default,according to <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="noreferrer">k8s documentation</a>, Services are assigned a DNS A record for a name of the form <code>my-svc.my-namespace.svc.cluster-domain.example</code>.</p>

<p>Is there a command to retrieve the full name of a service?</p>

<p>You can do a DNS query from any pod and you would get the FQDN.</p>

<pre><code># nslookup api-server
Server:     10.96.0.10
Address:    10.96.0.10#53

Name:   api-server.default.svc.cluster.local
Address: 10.104.225.18

root@api-server-6ff8c8b9c-6pgkb:/#
</code></pre>

<p><code>cluster-domain.example</code> is just a example in the documentation. <code>cluster.local</code> is the default cluster domain assigned. So the FQDN of any service by default would be <code>&lt;service-name&gt;.&lt;namespace&gt;.svc.cluster.local</code>. </p>

<p>You don't need to use the FQDN to access services - for services in same namespace, just the service name would be enough. For services in other namespaces, <code>&lt;service-name&gt;.&lt;namespace&gt;</code> would be enough as kubernetes would automatically set up the DNS search domains. </p>
