Duplicate DNS nameservers set by cloud-init on VM with multiple network devices

l2dy

New Member
Apr 26, 2025
3
1
3
On an Ubuntu 24.04 VM, cloud-init generates /etc/netplan/50-cloud-init.yaml with the same nameservers: section for every network interface configured. With multiple interfaces attached to a VM, systemd-resolved would pick up all of them, which results in the following /run/systemd/resolve/resolv.conf file:

Code:
nameserver 1.1.1.1
nameserver 1.1.1.1
nameserver 1.1.1.1
# Too many DNS servers configured, the following entries may be ignored.
nameserver 1.1.1.1
search .

Kubernetes also throws a warning if there are 3 or more DNS nameserver records, and my K3s cluster keeps spamming the system log:

k3s[812]: E0603 13:55:13.428800 812 dns.go:153] "Nameserver limits exceeded" err="Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 1.1.1.1 1.1.1.1 1.1.1.1"

Is it possible to only pass DNS servers and domains settings to one of the interfaces? Proxmox VE's management interface has separate DNS and IP config for cloud-init, but there is no option to customize DNS config for each interface.