I am deploying statefulset in my local PC (for doing research) follow this link
In this step:
kubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm
nslookup web-0.nginx
I meet this error:
nslookup web-0.nginx
Server: 10.96.0.10
Address 1: 10.96.0.10
nslookup: can't resolve 'web-0.nginx'
My pod and node are still working correctly and my coredns is running correctly
kube-system coredns-fb8b8dccf-hbrhw 1/1 Running 0 26m
kube-system coredns-fb8b8dccf-rmrwp 1/1 Running 0 26m
nguyen@kmaster:~/Documents$ kubectl get --all-namespaces=true -o wide pods
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
default busybox 1/1 Running 1 65m 10.244.1.218 knode <none> <none>
default web-0 1/1 Running 0 75m 10.244.1.215 knode <none> <none>
default web-1 1/1 Running 0 75m 10.244.1.216 knode <none> <none>
kube-system coredns-fb8b8dccf-hbrhw 1/1 Running 0 51m 10.244.1.219 knode <none> <none>
kube-system coredns-fb8b8dccf-rmrwp 1/1 Running 0 51m 10.244.0.37 kmaster <none> <none>
kube-system etcd-kmaster 1/1 Running 20 20d 192.168.146.132 kmaster <none> <none>
kube-system kube-apiserver-kmaster 1/1 Running 514 20d 192.168.146.132 kmaster <none> <none>
kube-system kube-controller-manager-kmaster 1/1 Running 144 20d 192.168.146.132 kmaster <none> <none>
kube-system kube-flannel-ds-amd64-ndpjq 1/1 Running 0 76m 192.168.146.129 knode <none> <none>
kube-system kube-flannel-ds-amd64-s2vhp 1/1 Running 0 76m 192.168.146.132 kmaster <none> <none>
kube-system kube-proxy-dk5jd 1/1 Running 6 20d 192.168.146.132 kmaster <none> <none>
kube-system kube-proxy-ts79l 1/1 Running 2 20d 192.168.146.129 knode <none> <none>
kube-system kube-scheduler-kmaster 1/1 Running 172 20d 192.168.146.132 kmaster <none> <none>
nguyen@kmaster:~$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 21d
nginx ClusterIP None <none> 80/TCP 6h8m
Did I miss something? Someone can help me. Thank you!
nginx statefulset is deployed in default namespace as shown below
default web-0 1/1 Running 0 75m 10.244.1.215 knode <none> <none>
default web-1 1/1 Running 0 75m 10.244.1.216 knode <none> <none>
This is how you should test
master $ kubectl get po
NAME READY STATUS RESTARTS AGE
web-0 1/1 Running 0 1m
web-1 1/1 Running 0 1m
master $ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 35m
nginx ClusterIP None <none> 80/TCP 2m
master $ kubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm
If you don't see a command prompt, try pressing enter.
/ # nslookup nginx
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: nginx
Address 1: 10.40.0.1 web-0.nginx.default.svc.cluster.local
Address 2: 10.40.0.2 web-1.nginx.default.svc.cluster.local
/ #
/ # nslookup web-0.nginx
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: web-0.nginx
Address 1: 10.40.0.1 web-0.nginx.default.svc.cluster.local
/ # nslookup web-0.nginx.default.svc.cluster.local
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: web-0.nginx.default.svc.cluster.local
Address 1: 10.40.0.1 web-0.nginx.default.svc.cluster.local