mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-12-05 12:06:20 +01:00
Add worker-1 (4 vCPU / 16 GiB) on shoryu, and worker-2 (4 vCPU / 16 GiB) plus worker-3 (2 vCPU / 8 GiB) on shushou, as microVMs. They come with a genK3sAgentModule and the per-host/output/home-manager wiring, and are labelled node-role.kubernetes.io/worker=true. The masters keep their control-plane:NoSchedule taint, so workloads land on the workers.
84 lines
1.8 KiB
Nix
84 lines
1.8 KiB
Nix
{
|
|
microvm,
|
|
myvars,
|
|
mylib,
|
|
agenix,
|
|
mysecrets,
|
|
...
|
|
}:
|
|
{
|
|
# Run the k3s-test VMs as MicroVMs instead of KubeVirt domains.
|
|
imports = [ microvm.nixosModules.host ];
|
|
|
|
microvm.vms.k3s-test-1-master-3 = {
|
|
autostart = true;
|
|
restartIfChanged = true;
|
|
specialArgs = {
|
|
inherit
|
|
myvars
|
|
mylib
|
|
agenix
|
|
mysecrets
|
|
;
|
|
};
|
|
config.imports = [ ../k8s/k3s-test-1-master-3 ];
|
|
};
|
|
|
|
microvm.vms.k3s-test-1-worker-2 = {
|
|
autostart = true;
|
|
restartIfChanged = true;
|
|
specialArgs = {
|
|
inherit
|
|
myvars
|
|
mylib
|
|
agenix
|
|
mysecrets
|
|
;
|
|
};
|
|
config.imports = [ ../k8s/k3s-test-1-worker-2 ];
|
|
};
|
|
|
|
microvm.vms.k3s-test-1-worker-3 = {
|
|
autostart = true;
|
|
restartIfChanged = true;
|
|
specialArgs = {
|
|
inherit
|
|
myvars
|
|
mylib
|
|
agenix
|
|
mysecrets
|
|
;
|
|
};
|
|
config.imports = [ ../k8s/k3s-test-1-worker-3 ];
|
|
};
|
|
|
|
# Attach the guest's tap to the VM bridge, the same way the physical NIC is
|
|
# attached. The tap name is derived from the guest IP (192.168.5.116 -> vm116,
|
|
# 192.168.5.112 -> vm112, 192.168.5.113 -> vm113), as IFNAMSIZ caps interface
|
|
# names at 15 characters.
|
|
systemd.network.networks."20-vm116" = {
|
|
matchConfig.Name = [ "vm116" ];
|
|
networkConfig = {
|
|
LinkLocalAddressing = "no";
|
|
Bridge = "br0";
|
|
};
|
|
linkConfig.RequiredForOnline = "no";
|
|
};
|
|
systemd.network.networks."20-vm112" = {
|
|
matchConfig.Name = [ "vm112" ];
|
|
networkConfig = {
|
|
LinkLocalAddressing = "no";
|
|
Bridge = "br0";
|
|
};
|
|
linkConfig.RequiredForOnline = "no";
|
|
};
|
|
systemd.network.networks."20-vm113" = {
|
|
matchConfig.Name = [ "vm113" ];
|
|
networkConfig = {
|
|
LinkLocalAddressing = "no";
|
|
Bridge = "br0";
|
|
};
|
|
linkConfig.RequiredForOnline = "no";
|
|
};
|
|
}
|