<p>Kubernetes admin can use <code>--cluster-domain</code> to customize cluster domain instead of using default one: <code>cluster.local</code> <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" rel="noreferrer">Kubelet Configs</a>. </p>

<p>So the question is, how does an application pod check this domain in runtime?</p>

<p>It needs to be configured on the DNS server.</p>

<p>Either <a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#kube-dns" rel="noreferrer">kube-dns</a> or <a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#coredns" rel="noreferrer">coredns</a> (Favored on newer K8s versions)</p>

<p>kube-dns: it's a cli option <a href="https://github.com/kubernetes/dns/blob/master/cmd/kube-dns/app/options/options.go#L148" rel="noreferrer"><code>--domain</code></a></p>

<p>core-dns: you can configure the <a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#configuration-of-stub-domain-and-upstream-nameserver-using-coredns" rel="noreferrer">K8s ConfigMap</a></p>

<p>And you see <a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#introduction" rel="noreferrer">here</a>:</p>

<blockquote>
  <p>The kubelet passes DNS to each container with the --cluster-dns= flag.</p>
</blockquote>

<p>If you'd like to know how a pod resolves <code>cluster.local</code> it does it through the <code>/etc/resolv.conf</code> that the kubelet mounts on every pod. The content is something like this:</p>

<pre><code>$ cat /etc/resolv.conf
nameserver 10.96.0.10
search &lt;namespace&gt;.svc.cluster.local svc.cluster.local cluster.local &lt;nod-domain&gt;
options ndots:5
</code></pre>

<p><code>10.96.0.10</code> is your <code>coredns</code> or <code>kube-dns</code> cluster IP address.</p>
