k8s/StudyNotes/ k8s DNS
Pods & Services
- Services.
DNS: <Hostname>.<Namespace>.<Type>.<Root=cluster.local>
- e.g. web-service.appsNs.svc.cluster.local
- Pods, do not get dns entries by default, can be enabled.
If pod dns enabled, creates record from ip 10.244.2.5 -> 10-244-2-5.appsNs.pod.cluster.local
- In same namespace web-service.
- In apps namespace apps.web-service
- Services.
- in container, /etc/resolve.conf, has k8s dns server as nameserver
- kubelet launches pods and does the /etc/resolve.conf setup.
adds to /etc/resolve.conf nameserver and for ns=default e.g search default.svc.cluster.local svc.cluster.local cluster.local
- kubelet launches pods and does the /etc/resolve.conf setup.
- CoreDNS (Service kube-dns)
- From v1.12 CoreDNS used for dns, deployed as pod in -n kube-system
config /etc/coredns/Corefile, passed into pod as configmap coredns.
- uses plugins
- From v1.12 CoreDNS used for dns, deployed as pod in -n kube-system