User Tools

Site Tools


wikiv3:kube_dns

Testar resolução DNS de Serviços e Pods

$ kubectl create -f https://k8s.io/examples/admin/dns/busybox.yaml
pod/busybox created
$ kubectl get pods -o wide
NAME      READY   STATUS    RESTARTS   AGE     IP               NODE                                 NOMINATED NODE   READINESS GATES
busybox   1/1     Running   0          45s     172.16.101.70    kube-worker-01.juntotelecom.com.br   <none>           <none>
pod1      2/2     Running   0          4h53m   172.16.213.132   kube-worker-02.juntotelecom.com.br   <none>           <none>
pod2      1/1     Running   0          110m    172.16.101.68    kube-worker-01.juntotelecom.com.br   <none>           <none>
pod3      1/1     Running   0          87m     172.16.213.133   kube-worker-02.juntotelecom.com.br   <none>           <none>
$ kubectl exec -it busybox -- cat /etc/resolv.conf
search default.svc.cluster.local svc.cluster.local cluster.local juntotelecom.com.br
nameserver 10.96.0.10
options ndots:5
$ kubectl get svc kube-dns -n kube-system
NAME       TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
kube-dns   ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   3d21h
$ kubectl get svc
NAME            TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes      ClusterIP      10.96.0.1       <none>        443/TCP        3d21h
nginx-service   LoadBalancer   10.110.75.105   <pending>     80:31852/TCP   90m
$ kubectl run -it --rm --restart=Never busybox --image=gcr.io/google-containers/busybox -- nslookup kubernetes.default
wikiv3/kube_dns.txt · Last modified: by 127.0.0.1