(Moving this here from <#C3ASABBD1|> since it's mo...
# k3s
a
(Moving this here from #C3ASABBD1 since it's more appropriate) Hi, everyone. I'm going crazy over the DNS config. Any help is appreciated. I am running k3s on a server node running ubuntu server (raspberry pi, official installation, 25.04). There is also another agent node, but I don't think that's relevant. Basically, when the k3s service is started, the DNS on both the host and in the pods stops working. On the host, it's handled by
systemd-resolved
which sets /etc/resolv.conf to:
Copy code
nameserver 127.0.0.53
options edns0 trust-ad
search .
While
/run/systemd/resolve/resolv.conf
has:
Copy code
nameserver 192.168.100.1 # this is my router's IP which has 8.8.8.8 and 1.1.1.1 as nameservers
nameserver fe80::1%3
search .
I never used
systemd-resolved
before, but from what I can tell, this is the expected behavior.
resolvectl status
returns:
Copy code
Global
         Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: stub

Link 2 (eth0)
    Current Scopes: none
         Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
     Default Route: no

Link 3 (wlan0)
    Current Scopes: DNS
         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.100.1
       DNS Servers: 192.168.100.1 fe80::1
     Default Route: yes
When I start k3s (with or without
--resolv-conf=/run/systemd/resolve/resolv.conf
). The only thing that changes is that
resolvectl status
returns additional links:
Copy code
Link 4 (flannel.1)
    Current Scopes: none
         Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
     Default Route: no

Link 5 (cni0)
    Current Scopes: none
         Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
     Default Route: no

Link 6 (vethdff630ff)
    Current Scopes: none
         Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
     Default Route: no

# and the rest are the same as link 6
Everything else is the same,
ufw
is always disabled, and yet DNS on the host (as well as inside the pods) simply stops working:
Copy code
> dig google.com
;; communications error to 127.0.0.53#53: connection refused
;; communications error to 127.0.0.53#53: connection refused
;; communications error to 127.0.0.53#53: connection refused

; <<>> DiG 9.20.11-0ubuntu0.2-Ubuntu <<>> google.com
;; global options: +cmd
;; no servers could be reached
I am not familiar enough with the internals of how exactly k3s interacts with the networking stack exactly so any help is appreciated. Thanks. Edit: I was wrong, the external hostname resolution actually works inside pods (and via
dig <http://google.com|google.com> @10.43.0.10
). What is actually failing is just the resolution on the host itself (which is why the pods are failing to download the images - i.e., they can't resolve quay.io and other domains). Edit2: Hardcoding /etc/resolv.conf to 192.168.100.1 "fixes" the issue. However, I would still like to know what is the expected way of dealing with this and why it happens.