<p>There is a comprehensive <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#troubleshooting-tips" rel="nofollow noreferrer">document</a> about k8s' DNS. According to this document one could validate whether the DNS is working by running:</p>

<p>busybox.yaml</p>

<blockquote>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: busybox
  namespace: default
spec:
  containers:
  - image: busybox
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
    name: busybox
  restartPolicy: Always
</code></pre>
</blockquote>

<p>and deploy it by issuing:</p>

<blockquote>
<pre><code>kubectl create -f busybox.yaml
</code></pre>
</blockquote>

<p>Once deployed, one could run:</p>

<blockquote>
<pre><code>kubectl get pods busybox
</code></pre>
</blockquote>

<p>and validate whether the DNS is working:</p>

<blockquote>
<pre><code>kubectl exec -ti busybox -- nslookup kubernetes.default
</code></pre>
</blockquote>

<p>There are additional validation steps that could be executed, including:</p>

<blockquote>
<pre><code>kubectl exec busybox cat /etc/resolv.conf
</code></pre>
</blockquote>

<p>verify the DNS policy, check whether the DNS pod runs, checking erros in the DNS pod:</p>

<blockquote>
<pre><code>kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c kubedns
kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c dnsmasq
kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c sidecar
</code></pre>
</blockquote>

<p>does the DNS service run?</p>

<blockquote>
<pre><code>kubectl get svc --namespace=kube-system
</code></pre>
</blockquote>

<p>exposed DNS endpoints?</p>

<blockquote>
<pre><code>kubectl get ep kube-dns --namespace=kube-system
</code></pre>
</blockquote>

<p>There are also multiple known issues regarding the k8s' DNS:</p>

<blockquote>
  <p>Linux’s libc is impossibly stuck (see this bug from 2005) with limits
  of just 3 DNS nameserver records and 6 DNS search records. Kubernetes
  needs to consume 1 nameserver record and 3 search records. This means
  that if a local installation already uses 3 nameservers or uses more
  than 3 searches, some of those settings will be lost. As a partial
  workaround, the node can run dnsmasq which will provide more
  nameserver entries, but not more search entries. You can also use
  kubelet’s --resolv-conf flag.</p>
</blockquote>

CC BY-SA 3.0
2017-12-10T10:57:05.210Z
2017-12-10T10:57:05.210Z
030
<p>In a stack with higher number of services it seems that Docker DNS does not work anymore which leads to effects that container's names are not known even to themselves.</p>

<p>While I have filed <a href="https://github.com/docker/for-win/issues/988" rel="nofollow noreferrer">this bug</a>, I wonder whether there is a way to debug this more extensively to "prove" the DNS error, or for example manually "fix" the DNS name.</p>

<p>Will be there some deeper error message?</p>

<p><strong>Note</strong>: The ping from outside does not work; I just find cumbersome that is not possible to ping your own DNS name.</p>

CC BY-SA 3.0
2017-08-09T14:58:06.103Z
Did you login to several containers and check whether ping other-dockername works? When I check the docker-compose, I read `cassandra-seed`. So ping cassandra-seed from one of the docker containers should work. Does it?
030
CC BY-SA 3.0
2017-08-10T19:12:39.863Z
The ping from outside does not work; I just find cumbersome that is not possible to ping your own DNS name.
Ta Mu
CC BY-SA 3.0
2017-12-10T10:30:05.477Z
What do you mean with `outside`, e.g. outside the POD, the k8s cluster?
030
CC BY-SA 3.0
2018-01-09T18:24:30.853Z
It’s not too difficult to open an interactive bash shell inside a docket instance. Could ping via that and verify what the system’s actual state is: http://askubuntu.com/questions/505506/ddg#507009
Moritz
<docker><dns><networking><virtualization>
Debug Docker DNS
Ta Mu
# Debug Docker DNS

(Asked by: username_0 on 2017-08-09)

In a stack with higher number of services it seems that Docker DNS does not work anymore which leads to effects that container's names are not known even to themselves.

While I have filed [this bug](https://github.com/docker/for-win/issues/988), I wonder whether there is a way to debug this more extensively to "prove" the DNS error, or for example manually "fix" the DNS name.

Will be there some deeper error message?

**Note**: The ping from outside does not work; I just find cumbersome that is not possible to ping your own DNS name.

**Tags:** docker, dns, networking, virtualization

> **Comments:**
> **username_1**: Did you login to several containers and check whether ping other-dockername works? When I check the docker-compose, I read `cassandra-seed`. So ping cassandra-seed from one of the docker containers should work. Does it?  
> **username_0**: The ping from outside does not work; I just find cumbersome that is not possible to ping your own DNS name.  
> **username_1**: What do you mean with `outside`, e.g. outside the POD, the k8s cluster?  
> **username_2**: It’s not too difficult to open an interactive bash shell inside a docket instance. Could ping via that and verify what the system’s actual state is: http://askubuntu.com/questions/505506/ddg#507009  

---

## 1 answers

### Answer by username_1 on 2017-12-10. Score: 2

There is a comprehensive document about k8s' DNS. According to this document one could validate whether the DNS is working by running:
busybox.yaml

apiVersion: v1
kind: Pod
metadata:
  name: busybox
  namespace: default
spec:
  containers:
  - image: busybox
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
    name: busybox
  restartPolicy: Always


and deploy it by issuing:

kubectl create -f busybox.yaml


Once deployed, one could run:

kubectl get pods busybox


and validate whether the DNS is working:

kubectl exec -ti busybox -- nslookup kubernetes.default


There are additional validation steps that could be executed, including:

kubectl exec busybox cat /etc/resolv.conf


verify the DNS policy, check whether the DNS pod runs, checking erros in the DNS pod:

kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c kubedns
kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c dnsmasq
kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c sidecar


does the DNS service run?

kubectl get svc --namespace=kube-system


exposed DNS endpoints?

kubectl get ep kube-dns --namespace=kube-system


There are also multiple known issues regarding the k8s' DNS:

Linux’s libc is impossibly stuck (see this bug from 2005) with limits
  of just 3 DNS nameserver records and 6 DNS search records. Kubernetes
  needs to consume 1 nameserver record and 3 search records. This means
  that if a local installation already uses 3 nameservers or uses more
  than 3 searches, some of those settings will be lost. As a partial
  workaround, the node can run dnsmasq which will provide more
  nameserver entries, but not more search entries. You can also use
  kubelet’s --resolv-conf flag.


---

