|
16 | 16 | pkgs.kubernetes # kubectl, kubeadm, kubelet |
17 | 17 | pkgs.cri-tools # crictl |
18 | 18 | pkgs.helix # editor |
| 19 | + pkgs.k9s |
| 20 | + pkgs.fish |
| 21 | + pkgs.stern |
19 | 22 | ]; |
20 | 23 |
|
21 | 24 | environment.variables.EDITOR = "hx"; |
|
47 | 50 | }; |
48 | 51 | }; |
49 | 52 |
|
50 | | - # -- CNI bridge config -- |
51 | | - # Simple bridge CNI — no cluster-level setup needed, just this config file. |
52 | | - environment.etc."cni/net.d/10-bridge.conflist".text = builtins.toJSON { |
| 53 | + # -- CNI ptp config -- |
| 54 | + # PTP (point-to-point) CNI: each pod gets a veth pair, no shared bridge. |
| 55 | + # Traffic between pods is routed at L3 on the host, which lets kube-proxy |
| 56 | + # iptables/ipvs rules see and rewrite service traffic correctly. |
| 57 | + environment.etc."cni/net.d/10-ptp.conflist".text = builtins.toJSON { |
53 | 58 | cniVersion = "1.0.0"; |
54 | | - name = "bridge"; |
| 59 | + name = "ptp"; |
55 | 60 | plugins = [ |
56 | 61 | { |
57 | | - type = "bridge"; |
58 | | - bridge = "cni0"; |
59 | | - isGateway = true; |
| 62 | + type = "ptp"; |
60 | 63 | ipMasq = true; |
61 | 64 | ipam = { |
62 | 65 | type = "host-local"; |
63 | | - ranges = [ [ { subnet = "10.244.0.0/16"; } ] ]; |
| 66 | + subnet = "10.113.37.0/24"; |
| 67 | + # Explicit gateway ensures the host-side veth always gets this IP, |
| 68 | + # which nixkube pods use to reach nix-serve on the VM. |
| 69 | + gateway = "10.113.37.1"; |
64 | 70 | routes = [ { dst = "0.0.0.0/0"; } ]; |
65 | 71 | }; |
66 | 72 | } |
|
137 | 143 | memorySize = 4096; |
138 | 144 | diskSize = 10240; |
139 | 145 | cores = 4; |
| 146 | + # cache=unsafe tells QEMU to ack writes immediately without flushing to the |
| 147 | + # host — eliminates the I/O errors that remount the FS read-only in tests. |
| 148 | + qemu.drives = lib.mkForce [ |
| 149 | + { |
| 150 | + name = "root"; |
| 151 | + file = "\"$NIX_DISK_IMAGE\""; |
| 152 | + driveExtraOpts = { |
| 153 | + cache = "unsafe"; |
| 154 | + format = "qcow2"; |
| 155 | + "if" = "ide"; |
| 156 | + }; |
| 157 | + } |
| 158 | + ]; |
140 | 159 | }; |
141 | 160 |
|
142 | 161 | # -- Interactive debug user -- |
|
160 | 179 | "d /var/run/nri 0755 root root -" |
161 | 180 | ]; |
162 | 181 |
|
| 182 | + # Serve the VM's /nix/store as an unsigned binary cache on port 5000. |
| 183 | + # nixkube pods use this as a trusted substituter so test workload paths can be |
| 184 | + # fetched without going to the internet (paths pre-populated via additionalPaths). |
| 185 | + services.nix-serve = { |
| 186 | + enable = true; |
| 187 | + package = pkgs.nix-serve-ng; |
| 188 | + bindAddress = "0.0.0.0"; |
| 189 | + port = 5000; |
| 190 | + }; |
| 191 | + |
163 | 192 | # Enable external networking for image pulls and nix binary cache access |
164 | 193 | # SLiRP provides DHCP + DNS automatically |
165 | 194 | networking.firewall.enable = false; |
|
0 commit comments