DNS problems on Kubeadm cluster on Ubuntu 22.04 #6497
-
Hi, In my environment, I have some Ubuntu 22.04 nodes and a local pfSense DNS serving them.
But I can't do it from pods on fresh install (Calico CNI):
This causes most pods not reaching outside the cluster/local environment, they can do it only with dnsConfig set to ndots = 1. How can I solve it? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Your upstream dns is providing a NOERROR answer for “google.com.urbaman.it” hence the client stops searching and does not send a query for “google.com” One work around can be to craft a custom resolv.conf that does not contain your urbaman.it domain as a search domain, and use that in your kubelet/kubeadm configs. |
Beta Was this translation helpful? Give feedback.
-
A search for “kubeadmn resolv.conf” should provide more detailed in depth explanations. |
Beta Was this translation helpful? Give feedback.
-
Works like a charm: https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/#applying-kubelet-configuration-changes It does not restart workloads as stated, I had to do it manually, and I also loose the feature to get local services resolved without the proper urbaman.it domain, but it works. Thank you very much! |
Beta Was this translation helpful? Give feedback.
In Kubernetes, hosts and pods use different resolv.conf files. The one pods use is constructed by kubelet and contains a list of cluster domains including local domains from the resolv.conf of the pod’s host. You’ll want to override that and tell kubelet to use an alternate resolv.conf - which would be a resolv.conf with your hosts upstreams, but without the private domain.