- Imagine I have a pod manifest where its image is in a private registry. How will Kubelet pull the image? Is it using /etc/resolv.conf or the DNS settings defined in CoreDNS in Kubernetes?
- Does the configuration of CNI affect DNS resolution in any sense?
2 Answers
- Kubelet uses the DNS settings defined in CoreDNS, not the
/etc/resolv.conf
file on the node. CoreDNS is the DNS server for the Kubernetes cluster, and it handles DNS resolution for all pods and services within the cluster. - Yes, CNI plugin is responsible for setting up the network interfaces in pods and configuring the network namespace.
Before a Pod is instantiated, Kubelet needs to pull the container image, and for this, it relies on the host's DNS settings, typically found in /etc/resolv.conf
. Kubelet does not use the DNS settings defined in CoreDNS within the Kubernetes cluster, as CoreDNS handles DNS resolution for services within running Pods, not for the Kubelet's image-pulling process.
The configuration of the Container Network Interface (CNI) doesn't affect DNS resolution for Kubelet's image pulls. The CNI is responsible for Pod networking after the Pod is instantiated, not before.