CoreDNS not configuring nameservers

I am using rke 1.2.4 to create my cluster. My pods’ /etc/resolv.conf is configured with a DNS server that matches the DNS server that was automatically filled in when I ran rke setup. However, I realized that the pods can’t resolve external hostnames using this entry and I need to add another nameerver in the pods (notably, 8.8.8.8). From the documentation on Rancher’s website on “Configuring CoreDNS”, the pod should pick up the namesevers configured on the host. I modifed /etc/resolv.conf on the host (both worker and master nodes), recreated my pod (actually deployment), went inside the pod and checked if ts /etc/resolv.confi was updated. It was not. I see one other option, which is to add an upstreamnameserver section in cluster.yml but I have not tried it (I’m worried about any inadvertant side effects, if any).

My question is, if I updated the hosts /etc/resolv.conf, why isn’t CoreDNS using it to resolve external queries?

This change requires a kubelet restart (if you used vi to edit the file).

1 Like

It’s not clear to me how to restart a kublet. I’ve been going through the docs and out on the Internet. Because everything is running as a docker container, is it sufficient to just get the container ID and restart it? I saw something about draining a node. Should I drain a node first?

RKE will only restart components if settings have changed, if you want to manually restart components, cordoning and draining a node before is the best option, after that you can reboot the node or just the kubelet (docker restart kubelet)

Thank you for getting back to me. I tried it and it worked.