<p>I am not able to reach the DNS server in k8s from Azure Container instances</p>
<p><strong>context:</strong></p>
<p>I have 2 pods in an Azure AKS Kubernetes cluster.</p>
<p>Pod1: name = pod1, internal IP = 10.34.33.112</p>
<p>Pod2: name = pod2, internal IP = 10.34.33.155, Cluster IP = 10.34.104.109</p>
<p>AKS DNS Service ip = <code>10.34.96.58</code></p>
<p>So, from pod1, I expect that <code>nslookup pod2</code> would return</p>
<p>(this works as expected)</p>
<pre><code>/ # nslookup pod2
Server:     10.34.96.58
Address:    10.34.96.58:53

Name:   pod2.default.svc.cluster.local
Address: 10.34.104.109
</code></pre>
<p><strong>Azure Container Instances</strong>:
When I am running commands from the Container Instance a ping to pod2's internal IP works.</p>
<p>This is because they are in the same Virtual network via a Network Profile</p>
<pre><code># ping 10.34.33.155
PING 10.34.33.155 (10.34.33.155): 56 data bytes
64 bytes from 10.34.33.155: seq=0 ttl=63 time=2.208 ms
64 bytes from 10.34.33.155: seq=1 ttl=63 time=1.101 ms
</code></pre>
<p>However,</p>
<pre><code># nslookup pod2.default.svc.cluster.local 10.34.96.42
;; connection timed out; no servers could be reached
</code></pre>
<p>Even if I specify the nameserver, and the full url for the pod, It cannot be reached.
I am not able to identify where the block is occurring.</p>
<p>any ideas? or Best Practices?</p>

Patrick
<p>I'm pretty sure that AKS dns service is only available from within the cluster.</p>
<p>Here is what I would do:</p>
<ul>
<li>I would associate a Private DNS zone with the Virtual Network of the AKS cluster.</li>
<li>I would also deploy the Azure Container Instance into this same network. (You'll need to assign a dedicated subnet to the Azure Container Instances service.)</li>
<li>I would add A records for the desired private IP addresses in the Private DNS Zone from step 1.</li>
</ul>
<p>The 3rd step is something you can do by hand, or on each deployment automatically, by extending the deployment script with an Azure CLI task where you configure Azure Private DNS Zone records. This depends on your situation: whether this is a POC or purely operational project or more like a constantly evolving, DevOps heavy environment with CI/CD and all that.</p>
<p>Note: I don't know much about your business requirements, but I'm suspicious that you would actually want to use service IPs instead of pod IPs. But there can be exception to that, so if you know what you are doing just ignore me :)</p>
