Kube-dns not running on my cloud server

Hi . I am trying to learn kubernetes, and during the dns lesson i found that i am unable to resolve the dns name.  I have my kube dns running and also i am not able to see any errors in the logs. 

kubectl version

Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:08:19Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}


kubeadmn version
 

kubeadm version: &version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:14:39Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
kube get pods -n namespace 
user@swathi07012:~$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-78fcdf6894-dbskk 1/1 Running 0 1d
coredns-78fcdf6894-jmkqf 1/1 Running 0 1d
etcd-swathi07012.mylabserver.com 1/1 Running 8 22d
kube-apiserver-swathi07012.mylabserver.com 1/1 Running 0 1d
kube-controller-manager-swathi07012.mylabserver.com 1/1 Running 0 1d
kube-flannel-ds-dwpcm 1/1 Running 8 22d
kube-flannel-ds-lrzfn 1/1 Running 10 22d
kube-flannel-ds-t5pmc 1/1 Running 10 22d
kube-proxy-gjjbd 1/1 Running 1 1d
kube-proxy-k68tn 1/1 Running 0 1d
kube-proxy-xc6cj 1/1 Running 0 1d
kube-scheduler-swathi07012.mylabserver.com 1/1 Running 0 1d

bit-of-nothing 
piVersion: 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@swathi07012:~$ kubectl exec -it busybox -- nslookup dns-target
Server: 10.96.0.10
Address: 10.96.0.10:53

** server can't find dns-target: NXDOMAIN

*** Can't find dns-target: No answer

user@swathi07012:~$ 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

*** Can't find bit-of-nothing: No answer


But i have the dns set up on my /cat/resolv

user@swathi07012:~$ kubectl exec -it busybox -- cat /etc/resolv.conf
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local mylabserver.com
options ndots:5

 kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name | head -1) -c coredns
2018/08/26 17:07:18 [INFO] CoreDNS-1.1.3
2018/08/26 17:07:18 [INFO] linux/amd64, go1.10.1, b0fd575c
2018/08/26 17:07:18 [INFO] plugin/reload: Running configuration MD5 = 2a066f12ec80aeb2b92740dd74c17138
.:53
CoreDNS-1.1.3
linux/amd64, go1.10.1, b0fd575c



Please help me with resolving my dns-name


  • post-author-pic
    Will B
    08-28-2018

    Did you create a service for bit-of-nothing? You can't nslookup a deployment, you will need a service in order for there to be an associated dns record.


    Try:

    kubectl exec -it busybox -- nslookup kubernetes.default
    That will make it clearer whether or not your dns is working at all.

  • post-author-pic
    swathi0701
    08-29-2018

    yes i did create the service 

    user@swathi07012:~$ kubectl exec -it busybox -- nslookup kubernetes.default
    Server: 10.96.0.10
    Address: 10.96.0.10:53

    ** server can't find kubernetes.default: NXDOMAIN

    *** Can't find kubernetes.default: No answer

    user@swathi07012:~$ kubectl get services
    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
    bit-of-nothing ClusterIP 10.98.157.209 <none> 80/TCP 16h
    kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 23d
    user@swathi07012:~$
    user@swathi07012:~$
    user@swathi07012:~$ kubectl get pods | grep bit-of-nothing
    bit-of-nothing-7459bfb799-69ldz 1/1 Running 0 16h
    bit-of-nothing-7459bfb799-tfvw7 1/1 Running 0 16h


  • post-author-pic
    Victor C
    08-29-2018

    Can you try a different busybox image ?

          kubectl run curl --image=radial/busyboxplus:curl -i --tty

    Then run.

           nslookup bit-of-nothing

           nslookup kubernetes.default




  • post-author-pic
    mgmazzucco-1332010e
    09-12-2018

    kubectl -n trail  exec ubuntu-65c557cd9f-54f2v -ti -- bash
    root@ubuntu-65c557cd9f-54f2v:/# nslookup kubernetes.default.svc.cluster.local
    Server: 10.96.0.10
    Address: 10.96.0.10#53

    Name: kubernetes.default.svc.cluster.local
    Address: 10.96.0.1

    root@ubuntu-65c557cd9f-54f2v:/# exit
    [marco@dude SANDBOX]$ kubectl -n trail exec busybox -- nslookup kubernetes.default.svc.cluster.local
    Server: 10.96.0.10
    Address: 10.96.0.10:53


    *** Can't find kubernetes.default.svc.cluster.local: No answer

    [marco@dude SANDBOX]$ kubectl -n trail run curl --image=radial/busyboxplus:curl -i --tty
    If you don't see a command prompt, try pressing enter.
    [ root@curl-87b54756-gwrsp:/ ]$ nslookup kubernetes.default.svc.cluster.local
    Server: 10.96.0.10
    Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

    Name: kubernetes.default.svc.cluster.local
    Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local
    [ root@curl-87b54756-gwrsp:/ ]$



    The one in the middle is the default busybox image one gets from "kubectl run --image=busybox".  Something isn't working with nslookup on this image.

  • post-author-pic
    Victor C
    09-12-2018

    The kubelet is unable to configure the busybox container to use kube-dns pod to resolve DNS names. 

    You can find more info by running,

    kubectl describe pod <busybox-id> to get more info. 


Looking For Team Training?

Learn More