Can someone enlighten me on how DNS resolution occurs before pod creation on a worker node?
My problem is the following:
I have a cluster wide docker registry that I have deployed sitting as a service that looks like this:
However, this address doesn’t resolve BEFORE pod creation if I try to use it, i.e.:
k run -it my-app --image=pidocker-docker-registry:5000 (or pidocker-docker-registry.default.svc.cluster.local:5000) --command – /bin/bash
What happens is I get an immediate ImagePull error because it can’t resolve the docker registry hostname.
But if I create a Pod first (say dnsutils) and then do a dig, everything works (as it should since I noticed that the dnsutil’s Pod has the right /etc/resolv.conf and search/domain entries).
I noticed in the doc under DNS troubleshooting there is the following line:
Kubernetes installs do not configure the nodes’
resolv.conffiles to use the cluster DNS by default, because that process is inherently distribution-specific. This should probably be implemented eventually.
Is this what I’m running into? The only way for me to “fix” this is to add the CoreDNS IP address to /etc/resolv.conf on the worker node itself which then allows the kubelet to resolve the FQDN of my docker registry and pull successfully.
Am I doing something wrong?