Skip to content

Commit 2b1bbdc

Browse files
authored
Merge pull request #40 from zdyxry/doc-dns
docs: update DNS architecture to use dedicated container
2 parents 50ad440 + 5552eee commit 2b1bbdc

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

ARCHITECTURE.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ Inside each container, a Fedora bootc VM runs via libvirt/QEMU. The VM boots fro
7070
The VM runs:
7171
- **CRI-O** as the container runtime
7272
- **kubelet** managed by kubeadm
73-
- **dnsmasq** (node1 only) for cluster DNS
73+
- **dnsmasq** (in a dedicated container) for cluster DNS
7474

7575
Resources per VM default to 4 vCPUs and 8192 MB RAM, configurable via `--vcpus` and `--memory`.
7676

7777
### Local Registry
7878

7979
A shared container registry (`bink-registry`) runs alongside clusters on the Podman bridge network at a static IP (`10.88.0.2:5000`). It is auto-created on first cluster start and shared across all clusters.
8080

81-
VMs reach the registry through passt networking since passt translates VM traffic through the container's network stack, which sits on the Podman bridge. DNS entry `registry.cluster.local` points to `10.88.0.2` via dnsmasq on node1. CRI-O and containers/registries.conf are configured to trust the registry without TLS.
81+
VMs reach the registry through passt networking since passt translates VM traffic through the container's network stack, which sits on the Podman bridge. DNS entry `registry.cluster.local` points to `10.88.0.2` via the cluster's dedicated DNS container. CRI-O and containers/registries.conf are configured to trust the registry without TLS.
8282

8383
The registry survives cluster stops and is only removed via `bink registry stop`. Data is persisted in the `bink-registry-data` volume.
8484

@@ -128,9 +128,9 @@ Including the cluster name in the hash avoids IP and MAC collisions when multipl
128128

129129
### DNS
130130

131-
dnsmasq runs on node1 and provides name resolution for the cluster network. All other nodes are configured (via cloud-init) to use node1's cluster IP as their DNS server.
131+
A dedicated DNS container (`k8s-<cluster>-dns`) runs dnsmasq on the Podman bridge network and provides name resolution for the cluster network. All nodes are configured (via cloud-init) to use this DNS container as their nameserver.
132132

133-
When a new node joins, its hostname and cluster IP are added to `/var/lib/dnsmasq/cluster-hosts` on node1, and dnsmasq is restarted. Entries follow the format: `<cluster-ip> <node-name> <node-name>.cluster.local`.
133+
When a new node joins, its hostname and cluster IP are added to `/var/lib/dnsmasq/cluster-hosts` in the DNS container, and dnsmasq is reloaded. Entries follow the format: `<cluster-ip> <node-name> <node-name>.cluster.local`.
134134

135135
Upstream DNS servers (`8.8.8.8`, `8.8.4.4`) handle external resolution. The search domain is `cluster.local`.
136136

@@ -147,6 +147,8 @@ Podman bridge (10.88.0.0/16)
147147
148148
├── k8s-dev-haproxy ──→ TCP LB across control-plane nodes:6443
149149
150+
├── k8s-dev-dns ──→ dnsmasq (cluster DNS, 53/udp)
151+
150152
├── k8s-dev-node1 ──→ VM NIC1 (passt): internet + port fwd
151153
│ ──→ VM NIC2 (mcast): 10.0.0.x/24
152154
@@ -219,7 +221,7 @@ A cluster starts with a single control-plane node (`node1`) and can grow by addi
219221
### Adding Nodes
220222

221223
1. Create a new container and VM (same process as node1)
222-
2. Register the new node's hostname and IP in dnsmasq on node1
224+
2. Register the new node's hostname and IP in the cluster DNS container
223225
3. Generate a join token on the control-plane: `kubeadm token create --print-join-command`
224226
4. For control-plane nodes: upload certificates and join with `--control-plane`, then update HAProxy config
225227
5. For worker nodes: join and label with `node-role.kubernetes.io/worker=worker`
@@ -274,7 +276,7 @@ The user-data configures:
274276
- kubelet with volume plugin directory
275277
- Kernel parameters (IP forwarding, `br_netfilter`)
276278
- virtiofs mount unit for shared images
277-
- dnsmasq (node1 only) with initial host entries
279+
- DNS entries for the cluster DNS container
278280
- ostree overlay for `/opt` (CNI plugin binaries)
279281

280282
## Key Paths
@@ -290,6 +292,7 @@ The user-data configures:
290292
| `/workspace/<node>.qcow2` | Node overlay disk |
291293
| `/workspace/<node>-cloud-init.iso` | Cloud-init ISO |
292294
| `/var/lib/libvirt/virtiofsd/virtiofsd.sock` | Virtiofs socket |
295+
| `/var/lib/dnsmasq/cluster-hosts` | DNS host entries (DNS container only) |
293296

294297
### Inside VMs
295298

@@ -298,5 +301,4 @@ The user-data configures:
298301
| `/etc/kubernetes/admin.conf` | Kubernetes admin kubeconfig |
299302
| `~/.kube/config` | User kubeconfig (core user) |
300303
| `/var/mnt/cluster_images` | Virtiofs mount (shared K8s images) |
301-
| `/var/lib/dnsmasq/cluster-hosts` | DNS entries (node1 only) |
302304
| `/opt/cni/bin` | CNI plugin binaries (tmpfs overlay) |

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ Host (podman)
235235
| `/var/run/cluster/cluster.key.pub` | SSH public key |
236236
| `/images/disk.qcow2` | Base VM disk (from images volume) |
237237
| `/var/lib/cluster-images/` | Shared filesystem (virtiofs, read-only) |
238+
| `/var/lib/dnsmasq/cluster-hosts` | DNS host entries (DNS container only) |
238239

239240
### Key Paths Inside VMs
240241

241242
| Path | Purpose |
242243
|------|---------|
243244
| `/etc/kubernetes/admin.conf` | Kubernetes admin kubeconfig |
244245
| `~/.kube/config` | User kubeconfig (core user) |
245-
| `/var/lib/dnsmasq/cluster-hosts` | DNS host entries (node1 only) |
246246

247247
## Running Tests
248248

0 commit comments

Comments
 (0)