Exercise: Cluster DNS & Service Discovery- DNS lookup not working

Hello,

Chad's example showed that he was running kube-dns in his cluster. On my cluster I am running coredns:

user@nasr861:~$ kubectl get pods -n kube-system

NAME READY STATUS RESTARTS AGE

coredns-576cbf47c7-bwbft 1/1 Running 0 34m

coredns-576cbf47c7-ts4lh 1/1 Running 0 34m

etcd-nasr861.mylabserver.com 1/1 Running 1 35m

kube-apiserver-nasr861.mylabserver.com 1/1 Running 0 15s

kube-controller-manager-nasr861.mylabserver.com 1/1 Running 0 14s

kube-dns-7bb584f494-5wwh2 3/3 Running 0 23m

kube-flannel-ds-amd64-dkbc7 1/1 Running 9 31d

kube-flannel-ds-amd64-mtbmp 1/1 Running 12 31d

kube-flannel-ds-amd64-vpt9n 1/1 Running 11 31d

kube-flannel-ds-amd64-w6lbx 1/1 Running 9 31d

kube-proxy-5wp2j 1/1 Running 0 34m

kube-proxy-7n5cd 1/1 Running 1 34m

kube-proxy-9sq6j 1/1 Running 0 34m

kube-proxy-vd557 1/1 Running 0 34m

kube-scheduler-nasr861.mylabserver.com 1/1 Running 7 35m


I am unable to nslookup bit-of-nothing from my busybox pod. I set up my bit-of-nothing deployment and exposed it as a service:


My bash history:

  613 kubectl apply -f bit-of-nothing.yaml

614 kubectl expose deployment bit-of-nothing

615 kubectl expose deployment bit-of-nothing --type='ClusterIP' --port=80

616 kubectl get services

617 kubectl exec -it busybox -- nslookup bit-of-nothing

618 history

user@nasr861:~$ kubectl exec -it busybox -- nslookup bit-of-nothing

Server: 10.96.0.10

Address: 10.96.0.10:53

** server can't find bit-of-nothing: NXDOMAIN

^Ccommand terminated with exit code 130

user@nasr861:~$ cat bit-of-nothing.yaml

apiVersion: apps/v1beta2

kind: Deployment

metadata:

name: bit-of-nothing

spec:

selector:

matchLabels:

app: pause

replicas: 2

template:

metadata:

labels:

app: pause

spec:

containers:

- name: bitty

image: k8s.gcr.io/pause:2.0

user@nasr861:~$ cat busybox-pod.yaml

apiVersion: v1

kind: Pod

metadata:

name: busybox

namespace: default

spec:

containers:

- name: busybox

image: busybox

command:

- sleep

- "3600"

imagePullPolicy: IfNotPresent

restartPolicy: Always


-----

Thanks in advance to anyone who can help me.

- Nasr
  • post-author-pic
    Will B
    10-18-2018

    I think there's actually a problem with nslookup in the latest version of busybox. Try the busybox:1.27 image, it seems to work on that version.

  • post-author-pic
    nasr86
    10-18-2018

    That worked! Thanks Will :)

Looking For Team Training?

Learn More