microk8s: pods cant resolve dns from external dns server

Ubuntu Server 22.04 microk8s enable dns

pods can ping ips of the network but cant resolve dns names in the network.

from node host i can resolve external dns correctly.

-- inside pod---

(ping to external dns ip)
# ping 10.58.20.1
PING 10.58.20.1 (10.58.20.1) 56(84) bytes of data.
64 bytes from 10.58.20.1: icmp_seq=1 ttl=127 time=0.487 ms

(ping to external dns name)
# ping dc01
ping: dc01: Name or service not known

# ping dc01.lab.local
ping: dc01: Name or service not known

# cat /etc/resolv.conf
search app.svc.cluster.local svc.cluster.local cluster.local lab.local
nameserver 10.152.183.10
options ndots:5
root@app-api-6d7f865754-9zcdg:/opt/app/api#

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 2
  • Comments: 17 (3 by maintainers)

Most upvoted comments

microk8s disable dns export dnss=cat /run/systemd/resolve/resolv.conf | grep nameserver | cut -d ' ' -f2 microk8s enable dns:$dnss

I tested this in Ubuntu Server 20.04.4 and no problem i can run apt-get update from my container and resolve correctly with my pods, looks like problem in 22.04 not mature enough