Answers: <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>
  
Answers: CC BY-SA 3.0
Answers: 2017-12-10T10:57:05.210Z
Answers: 2017-12-10T10:57:05.210Z
Answers: 030
Body: <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>
  
Comments: CC BY-SA 3.0
Comments: 2017-08-09T14:58:06.103Z
Comments: 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?
Comments: 030
Comments: CC BY-SA 3.0
Comments: 2017-08-10T19:12:39.863Z
Comments: The ping from outside does not work; I just find cumbersome that is not possible to ping your own DNS name.
Comments: Ta Mu
Comments: CC BY-SA 3.0
Comments: 2017-12-10T10:30:05.477Z
Comments: What do you mean with `outside`, e.g. outside the POD, the k8s cluster?
Comments: 030
Comments: CC BY-SA 3.0
Comments: 2018-01-09T18:24:30.853Z
Comments: 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
Comments: Moritz
Tags: <docker><dns><networking><virtualization>
Title: Debug Docker DNS
UserDisplayName: Ta Mu
ThreadText: # 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](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#troubleshooting-tips) 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.
  
  
  ---
  
  