<p>By default, when we raise a request from a Pod to another pod, Kubernetes is trying to append <code>.namespace.svc.cluster.local</code> to the domain we gave and try to resolve.</p>
<p>But in our case, we are already using a fully qualified URL to raise the request (<a href="http://service-name.namespace.svc.cluster.local/api/..." rel="nofollow noreferrer">http://service-name.namespace.svc.cluster.local/api/...</a>) in all the places, but here also Kubernetes will try to resolve DNS for <code>service-name.namespace.svc.cluster.local.namespace.svc.cluster.local</code> and try a bunch of other domains as well, at last only it will try the actually given domain.</p>
<p><strong>Question:</strong> Is there a way to configure Kubernetes to use the given domain for DNS resolve on the first try? If failed then it can try other domains</p>
<p><strong>Environment Info:</strong></p>
<p>Environment: AKS<br />
Pod OS: Debian GNU v10 (buster)</p>
<p><strong>Additional Info:</strong></p>
<p>Contents of <code>/etc/resolv.conf</code> inside a Pod</p>
<pre><code>search namespance.svc.cluster.local svc.cluster.local cluster.local reddog.microsoft.com
nameserver x.x.x.x
options ndots:5
</code></pre>
<p>Wireshark:</p>
<p><a href="https://i.stack.imgur.com/Xoxam.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xoxam.png" alt="enter image description here" /></a>
As you can see, for every single successful request, there are 4 failed request before it.</p>

<p>Lowering the <code>ndots</code> will fix the issue</p>
<blockquote>
<p>ndots: sets a threshold for the number of dots which must appear in a name before an initial absolute query will be made. The default for n is 1, meaning that if there are any dots in a name, the name will be tried first as an absolute name before any search list elements are appended to it.</p>
</blockquote>
<p>Try this :</p>
<pre><code>spec:
  containers:
    - name: ...
      image: ...
  dnsConfig:
    options:
      - name: ndots
        value: &quot;1&quot;
</code></pre>
