kubernetes: Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver

Hi Team, I am new to k8s. i am installed k8s cluster successfully and i am able to access k8s Dashboard. But i am unable to access other apps from outside. i am getting below error. Kindly suggest me.

root@k8s-master:~# kubectl get svc --all-namespaces
NAMESPACE              NAME                        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
default                kubernetes                  ClusterIP   10.96.0.1       <none>        443/TCP                  4d9h
default                nginx                       NodePort    10.99.240.41    <none>        80:31886/TCP             7h1m
kube-system            calico-etcd                 ClusterIP   10.96.232.136   <none>        6666/TCP                 3d10h
kube-system            kube-dns                    ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   4d9h
kubernetes-dashboard   dashboard-metrics-scraper   ClusterIP   10.107.90.107   <none>        8000/TCP                 4d9h
kubernetes-dashboard   kubernetes-dashboard        NodePort    10.100.20.227   <none>        443:31074/TCP            4d9h
root@k8s-master:~# telnet 172.105.41.155 31074
Trying 172.105.41.155...
Connected to 172.105.41.155.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
root@k8s-master:~# telnet 172.105.41.155 31886
Trying 172.105.41.155...
telnet: Unable to connect to remote host: No route to host
root@k8s-master:~#

Sep 16 14:30:57 k8s-master kubelet[1896]: E0916 14:30:57.426517 1896 dns.go:130] Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 172.105.35.5 172.105.36.5 172.105.37.5 Sep 16 14:31:25 k8s-master kubelet[1896]: E0916 14:31:25.426298 1896 dns.go:130] Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 172.105.35.5 172.105.36.5 172.105.37.5 Sep 16 14:31:32 k8s-master kubelet[1896]: E0916 14:31:32.426270 1896 dns.go:130] Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 172.105.35.5 172.105.36.5 172.105.37.5 Sep 16 14:31:56 k8s-master kubelet[1896]: E0916 14:31:56.426208 1896 dns.go:130] Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 172.105.35.5 172.105.36.5 172.105.37.5

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 28 (10 by maintainers)

Most upvoted comments

Boring bots have closed this issue but I’m just facing it now 😞

sigh

For posterity’s sake (because this issue is both unhelpful and a top search result) this reddit thread has some relevant info: https://www.reddit.com/r/kubernetes/comments/7ruq0f/kubelet_nameserver_limits_were_exceeded/

For posterity’s sake (because this issue is both unhelpful and a top search result) this reddit thread has some relevant info: https://www.reddit.com/r/kubernetes/comments/7ruq0f/kubelet_nameserver_limits_were_exceeded/

Thanks!

(The bots on this repo are worthless. Couldn’t say how many issues I have googled, just to run into an issue closed by a bot)

Looked at my pods and realized that this Kubernetes shooting itself in the foot and there looks to be little I can do about the neverending spam of warnings from this.

My nodes get their DNS from DHCP and there are 2 DNS servers. I have dual stack IPv4 and IPv6 - and each DNS server has an IP for each IP version. So 2 servers * 2 protocols = 4 entries.

Kubernetes should handle this a little more gracefully.

The condition itself may be harmless but the warning message is not - it pollutes the logs and generates a lot of spam events which clutter up etcd and contribute to unnecessary IOPS and latency, especially for very large clusters. Given that there is not an easy way to limit the number of DNS servers detected by DHCP and managed by NetworkManager, is there any way to disable the warning message so it stops making useless noise?

Silly human! How dare you question the decisions of our robot overlords!

I’m not familiar with Almalinux, so I booted an Almalinux 9 VM; apparently it’s using NetworkManager and its embedded DHCP client. Short of installing an external DHCP client (e.g. dhclient) and patching its script, here is what you can do:

List the connections that you have:

nmcli con show

On my VM, there is one named “System eth0”.

Check the DNS parameters:

nmcli con show "System 0" | grep dns

Now you have a few possibilities here, depending on what you see.

If you see hard-coded DNS servers (which will typically be the case when network provisioning is done through cloud-init), you can keep just the first one, for instance like this:

DNS=$(nmcli --terse con show "System eth0" | grep ^ipv6.dns: | cut -d: -f2- | cut -d, -f1)
nmcli con modify "System eth0" ipv6.dns $DNS
nmcli device reapply eth0

The changes are persistent (you don’t need to repeat them at each boot). If cloud-init overwrites them you can run the command again.

Now, if DHCP is used for both IPv4 and IPv6, you could either disable the DNS servers obtained through one of the protocols; or, if you don’t like that, you could trim the DNS list on one or both protocols by getting the DNS server address, and then set it to be hardcoded:

DNS=$(nmcli --terse con show "System eth0" | grep ^IP4.DNS | head -n1 | cut -d: -f2)
nmcli con modify "System eth0" ipv4.ignore-auto-dns yes
nmcli con modify "System eth0" ipv4.dns $DNS
nmcli device reapply eth0

I hope this helps!