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

Open
#229 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
docker, kubernetes, linux, rust

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Rust
Stars
7.5k
Forks
329
Avg merge
7h 48m
Merged PRs (30d)
105

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libracoder/kiri

All issues in libracoder/kiri

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.