Skip to content

Commit

Permalink
Use dnsutils image for DNS debugging (#18001)
Browse files Browse the repository at this point in the history
DNS debugging documentation is using a busybox image as example.
This image has different known issues with the way it resolves
the DNS names in k8s, creating confusion with users that try to
follow the docs.

The e2e tests use a custom small image ~4.3MB for DNS testing
with all the necessary tools. Also, the fact that this image is
being used for the k8s e2e testing guarantees it's compatibility.
  • Loading branch information
aojea authored and k8s-ci-robot committed Jan 15, 2020
1 parent a3c0cc6 commit d2dc2c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ This page provides hints on diagnosing DNS problems.

### Create a simple Pod to use as a test environment

Create a file named busybox.yaml with the following contents:
Create a file named dnsutils.yaml with the following contents:

{{< codenew file="admin/dns/busybox.yaml" >}}
{{< codenew file="admin/dns/dnsutils.yaml" >}}

Then create a pod using this file and verify its status:

```shell
kubectl apply -f https://k8s.io/examples/admin/dns/busybox.yaml
pod/busybox created
kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml
pod/dnsutils created

kubectl get pods busybox
kubectl get pods dnsutils
NAME READY STATUS RESTARTS AGE
busybox 1/1 Running 0 <some-time>
dnsutils 1/1 Running 0 <some-time>
```

Once that pod is running, you can exec `nslookup` in that environment.
If you see something like the following, DNS is working correctly.

```shell
kubectl exec -ti busybox -- nslookup kubernetes.default
kubectl exec -ti dnsutils -- nslookup kubernetes.default
Server: 10.0.0.10
Address 1: 10.0.0.10

Expand All @@ -56,7 +56,7 @@ Take a look inside the resolv.conf file.
[Known issues](#known-issues) below for more information)

```shell
kubectl exec busybox cat /etc/resolv.conf
kubectl exec dnsutils cat /etc/resolv.conf
```

Verify that the search path and name server are set up like the following
Expand All @@ -72,7 +72,7 @@ Errors such as the following indicate a problem with the coredns/kube-dns add-on
associated Services:

```
kubectl exec -ti busybox -- nslookup kubernetes.default
kubectl exec -ti dnsutils -- nslookup kubernetes.default
Server: 10.0.0.10
Address 1: 10.0.0.10
Expand All @@ -82,7 +82,7 @@ nslookup: can't resolve 'kubernetes.default'
or

```
kubectl exec -ti busybox -- nslookup kubernetes.default
kubectl exec -ti dnsutils -- nslookup kubernetes.default
Server: 10.0.0.10
Address 1: 10.0.0.10 kube-dns.kube-system.svc.cluster.local
Expand Down
14 changes: 14 additions & 0 deletions content/en/examples/admin/dns/dnsutils.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
name: dnsutils
namespace: default
spec:
containers:
- name: dnsutils
image: gcr.io/kubernetes-e2e-test-images/dnsutils:1.3
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
restartPolicy: Always

0 comments on commit d2dc2c6

Please sign in to comment.