Member-only story
DevOps in K8s — CoreDNS, Part Two
Note, full “DevOps in K8s” mind map is available at: “DevOps in K8s Mind Map”
In my article “DevOps in K8s — CoreDNS, Part One”, I introduced the concept of “CoreDNS”, what problem does it solve and how does it work. Let’s see some real world examples.
Busybox Pod Demo
Let’s create a busybox
Pod with the following command:
$ kubectl run -it --image busybox:1.25.0 test-pod --restart=Never --rm /bin/sh
/ # cat /etc/resolv.conf
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
/ #
As you can see from the above output, the /etc/resolv.conf
file in busybox
pod is pointing to nameserver 10.96.0.10
.
This IP address is the CLUSTER-IP
of the kube-dns
service:
$ kubectl get svc -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 1d
Now let’s query the nginx-service
using DNS name:
/ # nsloopup nginx-service.default.svc.cluster.local
Server: 10.96.0.10
Address: 10.96.0.10:53
Name…