Linux: kind node container gets the bridge gateway (172.20.0.1) as its resolver — DNS inside the node times out

Aperta
#229 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, kubernetes, linux, rust

Direzione di ricerca

Start by reading the container network and DNS configuration paths; the issue does not name source files or tests. Reproduce with the provided kind setup on Linux and inspect /etc/resolv.conf for the node and a plain container on the same network. Done means kind nodes receive working DNS that resolves external names and network container names, and image pulls and pod DNS succeed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Kiri version and system

0.2.0 (kiri-desktop-bin from the AUR) on CachyOS (Arch Linux), kernel 7.3.4-1-cachyos, systemd 262. Native Linux engine, no VM.

What you did

Create a kind cluster on Kiri (kind v0.27.0 via ctlptl v0.9.6, node image kindest/node:v1.32.2, on a pre-created kind network — the network is pre-created with explicit subnets because of #228):

$ DOCKER_HOST=unix:///run/kiri/docker.sock kind create cluster --name smartmix --image kindest/node:v1.32.2

Then look at the node container's resolver and try any image pull inside the cluster.

What happened

The node container's /etc/resolv.conf contains only the network gateway, where nothing answers:

$ docker --context kiri exec smartmix-control-plane cat /etc/resolv.conf
nameserver 172.20.0.1

So containerd inside the node cannot resolve anything, and every in-cluster image pull fails:

Failed to pull image "docker.io/library/nginx:1.27-alpine": ... dial tcp: lookup registry-1.docker.io on 172.20.0.1:53: read udp 172.20.0.2:52887->172.20.0.1:53: i/o timeout

CoreDNS then can't forward either, so all pod DNS is dead too.

For comparison, a plain container on the same network gets Kiri's embedded DNS, which works:

$ docker --context kiri run --rm --network kind busybox cat /etc/resolv.conf
nameserver 127.0.0.11
$ docker --context kiri run --rm --network kind busybox nslookup kind-registry
Name:	kind-registry
Address: fc00:f853:ccd:e793::3

Only the kind node container ended up with the gateway address instead.

What you expected instead

What Docker Engine does: containers on a user-defined network get the embedded DNS (127.0.0.11), which resolves both external names and container names on the network — the node container included. On Docker, kind nodes resolve registry-1.docker.io out of the box.

Anything else

Workaround I'm using (survives until the node container is recreated):

$ docker --context kiri exec smartmix-control-plane sh -c 'printf "nameserver 1.1.1.1\nnameserver 8.8.8.8\n" > /etc/resolv.conf'
$ docker --context kiri exec smartmix-control-plane sh -c 'echo "172.20.0.3 kind-registry" >> /etc/hosts'   # containerd reaches the local registry by name

The second line is needed because the node's containerd resolves the local registry container by hostname (kind-registry), which public resolvers don't know. Since the embedded DNS at 127.0.0.11 works and resolves container names, pointing the node container's resolv.conf there may be the complete fix on Kiri's side.

Related: #44 (bridge outbound on Windows) and #209 (BuildKit DNS on Windows) are a different platform, but the theme of per-network DNS gaps is similar.

Lingua principale
Rust
Stelle
7.5k
Fork
329
Merge medio
7h 48m
PR unite (30g)
105

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libracoder/kiri

Tutte le issue di libracoder/kiri

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.