refactor: rename the three VM hosts to 12kingdoms-*

Drop the now-meaningless kubevirt- prefix and move the hosts out of
hosts/k8s/, following the existing 12kingdoms-shoukei layout: the
directory and output carry the theme prefix while the configuration,
hostname and colmena target are the bare name (shoryu, shushou, youko).

- hosts/k8s/kubevirt-* -> hosts/12kingdoms-*; the shared disko config
  becomes host-disko-fs.nix; the now-different relative imports are fixed
- outputs, vars/networking.nix keys, the Justfile recipes/tags, the eval
  tests and the docs follow
- colmena reaches these hosts by IP (a new targetHost override), since
  their DNS name changes with the hostname and is not resolvable until
  the router learns it
This commit is contained in:
Ryan Yin committed 2026-09-21 17:10:14 +08:00
1 parent 3aec8341dd
commit 2c7629000f
103 files changed
+78 -54

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ deployments. Keep repository guidance here; reusable global rules live in `agent
- Deployment and upload recipes change systems; use eval/build commands for validation. Remote - Deployment and upload recipes change systems; use eval/build commands for validation. Remote
deployment requires an explicit request. When deployment behavior changes, report the exact `just` deployment requires an explicit request. When deployment behavior changes, report the exact `just`
command to run. command to run.
- KubeVirt hosts (`kubevirt-shoryu`/`shushou`/`youko`): avoid mid-flight restarts of the network - KubeVirt hosts (`shoryu`/`shushou`/`youko`): avoid mid-flight restarts of the network
stack (`systemd-networkd` / the `br0` bridge) — that can drop the VM network. Use `boot` + serial stack (`systemd-networkd` / the `br0` bridge) — that can drop the VM network. Use `boot` + serial
reboot for networking or nixpkgs changes. See reboot for networking or nixpkgs changes. See
[hosts/README.md](./hosts/README.md#deploying-kubevirt-hosts). [hosts/README.md](./hosts/README.md#deploying-kubevirt-hosts).
+4 -4
View File
@@ -197,7 +197,7 @@ upload-vm name size verbosity="normal":
use {{utils_nu}} *; use {{utils_nu}} *;
upload-vm {{name}} {{size}} {{verbosity}} upload-vm {{name}} {{size}} {{verbosity}}
# Deploy all the KubeVirt nodes(Physical machines running KubeVirt) # Deploy all the VM hosts (physical machines running the VMs)
[linux] [linux]
[group('homelab')] [group('homelab')]
lab mode="switch": lab mode="switch":
@@ -206,17 +206,17 @@ lab mode="switch":
[linux] [linux]
[group('homelab')] [group('homelab')]
shoryu mode="switch": shoryu mode="switch":
colmena apply {{mode}} --on '@kubevirt-shoryu' --verbose --show-trace colmena apply {{mode}} --on '@shoryu' --verbose --show-trace
[linux] [linux]
[group('homelab')] [group('homelab')]
shushou mode="switch": shushou mode="switch":
colmena apply {{mode}} --on '@kubevirt-shushou' --verbose --show-trace colmena apply {{mode}} --on '@shushou' --verbose --show-trace
[linux] [linux]
[group('homelab')] [group('homelab')]
youko mode="switch": youko mode="switch":
colmena apply {{mode}} --on '@kubevirt-youko' --verbose --show-trace colmena apply {{mode}} --on '@youko' --verbose --show-trace
############################################################################ ############################################################################
# #
+2 -2
View File
@@ -1,6 +1,6 @@
## How to create & managage KubeVirt's Virtual Machine from this flake? ## How to create & managage KubeVirt's Virtual Machine from this flake?
> [!NOTE] KubeVirt is being retired. aquamarine runs natively on `kubevirt-youko` and the k3s-test > [!NOTE] KubeVirt is being retired. aquamarine runs natively on `youko` and the k3s-test
> nodes run as [microVMs](./hosts/k8s/README.md); this document only covers the KubeVirt VMs that > nodes run as [microVMs](./hosts/k8s/README.md); this document only covers the KubeVirt VMs that
> are left to move (currently the Windows VM). > are left to move (currently the Windows VM).
@@ -22,7 +22,7 @@ commands:
```shell ```shell
just col aquamarine just col aquamarine
just col kubevirt-shoryu just col shoryu
# Set a configuration for the next boot instead of switching immediately # Set a configuration for the next boot instead of switching immediately
just col aquamarine boot just col aquamarine boot
@@ -8,7 +8,7 @@
}: }:
let let
# MoreFine - S500Plus # MoreFine - S500Plus
hostName = "kubevirt-shoryu"; # Define your hostname. hostName = "shoryu"; # Define your hostname.
coreModule = mylib.genVmHostModule { coreModule = mylib.genVmHostModule {
inherit pkgs hostName; inherit pkgs hostName;
@@ -18,7 +18,7 @@ in
{ {
imports = (mylib.scanPaths ./.) ++ [ imports = (mylib.scanPaths ./.) ++ [
disko.nixosModules.default disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix ../k8s/disko-config/host-disko-fs.nix
./hardware-configuration.nix ./hardware-configuration.nix
./preservation.nix ./preservation.nix
coreModule coreModule
File renamed without changes.
@@ -21,7 +21,7 @@
mysecrets mysecrets
; ;
}; };
config.imports = [ ../k3s-test-1-master-1 ]; config.imports = [ ../k8s/k3s-test-1-master-1 ];
}; };
# Attach the guest's tap to the VM bridge, the same way the physical NIC is # Attach the guest's tap to the VM bridge, the same way the physical NIC is
@@ -7,7 +7,7 @@
... ...
}: }:
let let
hostName = "kubevirt-shushou"; # Define your hostname. hostName = "shushou"; # Define your hostname.
coreModule = mylib.genVmHostModule { coreModule = mylib.genVmHostModule {
inherit pkgs hostName; inherit pkgs hostName;
@@ -17,9 +17,9 @@ in
{ {
imports = (mylib.scanPaths ./.) ++ [ imports = (mylib.scanPaths ./.) ++ [
disko.nixosModules.default disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix ../k8s/disko-config/host-disko-fs.nix
../kubevirt-shoryu/hardware-configuration.nix ../12kingdoms-shoryu/hardware-configuration.nix
../kubevirt-shoryu/preservation.nix ../12kingdoms-shoryu/preservation.nix
coreModule coreModule
]; ];
@@ -21,7 +21,7 @@
mysecrets mysecrets
; ;
}; };
config.imports = [ ../k3s-test-1-master-3 ]; config.imports = [ ../k8s/k3s-test-1-master-3 ];
}; };
# Attach the guest's tap to the VM bridge, the same way the physical NIC is # Attach the guest's tap to the VM bridge, the same way the physical NIC is
@@ -1,6 +1,6 @@
{ myvars, ... }: { myvars, ... }:
let let
hostAddress = myvars.networking.hostsAddr.kubevirt-shushou.ipv4; hostAddress = myvars.networking.hostsAddr.shushou.ipv4;
in in
{ {
power.ups = { power.ups = {
@@ -7,7 +7,7 @@
... ...
}: }:
let let
hostName = "kubevirt-youko"; # Define your hostname. hostName = "youko"; # Define your hostname.
coreModule = mylib.genVmHostModule { coreModule = mylib.genVmHostModule {
inherit pkgs hostName; inherit pkgs hostName;
@@ -17,9 +17,9 @@ in
{ {
imports = (mylib.scanPaths ./.) ++ [ imports = (mylib.scanPaths ./.) ++ [
disko.nixosModules.default disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix ../k8s/disko-config/host-disko-fs.nix
../kubevirt-shoryu/hardware-configuration.nix ../12kingdoms-shoryu/hardware-configuration.nix
../kubevirt-shoryu/preservation.nix ../12kingdoms-shoryu/preservation.nix
coreModule coreModule
]; ];
@@ -1,7 +1,7 @@
# Auto disk partitioning (from repo root: nix-config): # Auto disk partitioning (from repo root: nix-config):
# nix run github:nix-community/disko -- --mode destroy,format,mount hosts/k8s/kubevirt-youko/homelab-services/disko-fs.nix # nix run github:nix-community/disko -- --mode destroy,format,mount hosts/12kingdoms-youko/homelab-services/disko-fs.nix
# Mount only (after first format): # Mount only (after first format):
# nix run github:nix-community/disko -- --mode mount hosts/k8s/kubevirt-youko/homelab-services/disko-fs.nix # nix run github:nix-community/disko -- --mode mount hosts/12kingdoms-youko/homelab-services/disko-fs.nix
let let
cryptKeyFile = "/etc/agenix/hdd-luks-crypt-key"; cryptKeyFile = "/etc/agenix/hdd-luks-crypt-key";
unlockDisk = "data-encrypted"; unlockDisk = "data-encrypted";
@@ -101,10 +101,10 @@ in
params.ups = [ "homelab" ]; params.ups = [ "homelab" ];
static_configs = [ static_configs = [
{ {
targets = [ "${myvars.networking.hostsAddr.kubevirt-shushou.ipv4}:9199" ]; targets = [ "${myvars.networking.hostsAddr.shushou.ipv4}:9199" ];
labels.type = "app"; labels.type = "app";
labels.app = "nut"; labels.app = "nut";
labels.host = "kubevirt-shushou"; labels.host = "shushou";
labels.env = "homelab"; labels.env = "homelab";
labels.cluster = "homelab"; labels.cluster = "homelab";
} }
@@ -44,9 +44,9 @@ in
backupPrepareCommand = '' backupPrepareCommand = ''
${pkgs.nushell}/bin/nu -c ' ${pkgs.nushell}/bin/nu -c '
let kubevirt_nodes = [ let kubevirt_nodes = [
"kubevirt-shoryu" "shoryu"
"kubevirt-shushou" "shushou"
"kubevirt-youko" "youko"
] ]
kubevirt_nodes | each {|it| kubevirt_nodes | each {|it|
@@ -21,7 +21,7 @@
mysecrets mysecrets
; ;
}; };
config.imports = [ ../k3s-test-1-master-2 ]; config.imports = [ ../k8s/k3s-test-1-master-2 ];
}; };
# Attach the guest's tap to the VM bridge, the same way the physical NIC is # Attach the guest's tap to the VM bridge, the same way the physical NIC is
File renamed without changes.
+2 -2
View File
@@ -104,13 +104,13 @@ Use existing hosts as templates. The key files typically include:
### Examples to Reference ### Examples to Reference
- **Desktop systems**: See `idols-ai/` for gaming/workstation setup - **Desktop systems**: See `idols-ai/` for gaming/workstation setup
- **Server systems**: See `kubevirt-shoryu/` for K8s/KubeVirt hosts - **Server systems**: See `shoryu/` for K8s/KubeVirt hosts
- **macOS systems**: See `darwin-fern/` for macOS configurations - **macOS systems**: See `darwin-fern/` for macOS configurations
- **Apple Silicon**: See `12kingdoms-shoukei/` for ARM Linux setup - **Apple Silicon**: See `12kingdoms-shoukei/` for ARM Linux setup
## Deploying KubeVirt Hosts ## Deploying KubeVirt Hosts
The three KubeVirt hosts (`kubevirt-shoryu`, `kubevirt-shushou`, `kubevirt-youko`) put their VMs' The three KubeVirt hosts (`shoryu`, `shushou`, `youko`) put their VMs'
secondary network on the Linux bridge `br0` (attached by the `bridge` CNI plugin); the pod network secondary network on the Linux bridge `br0` (attached by the `bridge` CNI plugin); the pod network
is Cilium (flannel disabled). is Cilium (flannel disabled).
+2 -2
View File
@@ -39,11 +39,11 @@ keeps its identity and etcd membership instead of bootstraping a new cluster.
## TODO / Known issues ## TODO / Known issues
- **Retire KubeVirt.** aquamarine now runs natively on `kubevirt-youko`, and the k3s-test masters - **Retire KubeVirt.** aquamarine now runs natively on `youko`, and the k3s-test masters
run as microVMs. Remove KubeVirt/CDI/multus from the cluster (k8s-gitops) once nothing else needs run as microVMs. Remove KubeVirt/CDI/multus from the cluster (k8s-gitops) once nothing else needs
them, and the Windows VM is the only KubeVirt VM left to move. them, and the Windows VM is the only KubeVirt VM left to move.
- **The USB HDD bridge is flaky.** aquamarine's two HDDs sit behind a JMicron JMS567 USB-SATA bridge - **The USB HDD bridge is flaky.** aquamarine's two HDDs sit behind a JMicron JMS567 USB-SATA bridge
that keeps resetting (`dmesg` on `kubevirt-youko`). Find out how often it resets and how much it that keeps resetting (`dmesg` on `youko`). Find out how often it resets and how much it
matters before putting anything critical (e.g. an NFS export) on it. matters before putting anything critical (e.g. an NFS export) on it.
## Kubernetes Resources ## Kubernetes Resources
+1 -1
View File
@@ -17,7 +17,7 @@ sudo nix --experimental-features "nix-command flakes" run github:nix-community/d
systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 /dev/<encrypted-disk-part-path> systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 /dev/<encrypted-disk-part-path>
## 3. install nixos ## 3. install nixos
sudo nixos-install --root /mnt --no-root-password --show-trace --verbose --flake .#kubevirt-shoryu sudo nixos-install --root /mnt --no-root-password --show-trace --verbose --flake .#shoryu
# enter into the installed system, check password & users # enter into the installed system, check password & users
# `su ryan` => `sudo -i` => enter ryan's password => successfully login # `su ryan` => `sudo -i` => enter ryan's password => successfully login
+4 -1
View File
@@ -8,6 +8,9 @@
system, system,
tags, tags,
ssh-user, ssh-user,
# optional override; defaults to the host name. Use an IP when the host's
# DNS name is not resolvable yet (e.g. right after a hostname change).
targetHost ? null,
genSpecialArgs, genSpecialArgs,
specialArgs ? (genSpecialArgs system), specialArgs ? (genSpecialArgs system),
... ...
@@ -20,7 +23,7 @@ in
deployment = { deployment = {
inherit tags; inherit tags;
targetUser = ssh-user; targetUser = ssh-user;
targetHost = name; # hostName or IP address targetHost = if targetHost != null then targetHost else name;
}; };
imports = imports =
+3 -3
View File
@@ -97,9 +97,9 @@ All the outputs of this flake are defined here.
│ ├── k3s-test-1-worker-1.nix │ ├── k3s-test-1-worker-1.nix
│ ├── k3s-test-1-worker-2.nix │ ├── k3s-test-1-worker-2.nix
│ ├── k3s-test-1-worker-3.nix │ ├── k3s-test-1-worker-3.nix
│   ├── kubevirt-shoryu.nix │   ├── shoryu.nix
│   ├── kubevirt-shushou.nix │   ├── shushou.nix
│   └── kubevirt-youko.nix │   └── youko.nix
└── tests # eval tests └── tests # eval tests
├── home-manager ├── home-manager
│   ├── expected.nix │   ├── expected.nix
@@ -11,7 +11,7 @@
... ...
}@args: }@args:
let let
name = "kubevirt-shoryu"; name = "shoryu";
tags = [ tags = [
name name
"virt-shoryu" "virt-shoryu"
@@ -25,7 +25,7 @@ let
"secrets/nixos.nix" "secrets/nixos.nix"
"modules/nixos/server/server.nix" "modules/nixos/server/server.nix"
# host specific # host specific
"hosts/k8s/${name}" "hosts/12kingdoms-${name}"
]) ])
++ [ ++ [
{ {
@@ -43,7 +43,14 @@ in
{ {
nixosConfigurations.${name} = mylib.nixosSystem systemArgs; nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; }); colmena.${name} = mylib.colmenaSystem (
systemArgs
// {
inherit tags ssh-user;
# reach the host by IP: its DNS name changes with the hostname
targetHost = myvars.networking.hostsAddr.${name}.ipv4;
}
);
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso; packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso;
} }
@@ -11,7 +11,7 @@
... ...
}@args: }@args:
let let
name = "kubevirt-shushou"; name = "shushou";
tags = [ tags = [
name name
"virt-shushou" "virt-shushou"
@@ -25,7 +25,7 @@ let
"secrets/nixos.nix" "secrets/nixos.nix"
"modules/nixos/server/server.nix" "modules/nixos/server/server.nix"
# host specific # host specific
"hosts/k8s/${name}" "hosts/12kingdoms-${name}"
]) ])
++ [ ++ [
{ {
@@ -40,7 +40,14 @@ in
{ {
nixosConfigurations.${name} = mylib.nixosSystem systemArgs; nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; }); colmena.${name} = mylib.colmenaSystem (
systemArgs
// {
inherit tags ssh-user;
# reach the host by IP: its DNS name changes with the hostname
targetHost = myvars.networking.hostsAddr.${name}.ipv4;
}
);
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso; packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso;
} }
@@ -11,7 +11,7 @@
... ...
}@args: }@args:
let let
name = "kubevirt-youko"; name = "youko";
tags = [ tags = [
name name
"virt-youko" "virt-youko"
@@ -25,7 +25,7 @@ let
"secrets/nixos.nix" "secrets/nixos.nix"
"modules/nixos/server/server.nix" "modules/nixos/server/server.nix"
# host specific # host specific
"hosts/k8s/${name}" "hosts/12kingdoms-${name}"
]) ])
++ [ ++ [
{ {
@@ -40,7 +40,14 @@ in
{ {
nixosConfigurations.${name} = mylib.nixosSystem systemArgs; nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; }); colmena.${name} = mylib.colmenaSystem (
systemArgs
// {
inherit tags ssh-user;
# reach the host by IP: its DNS name changes with the hostname
targetHost = myvars.networking.hostsAddr.${name}.ipv4;
}
);
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso; packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso;
} }
@@ -3,7 +3,7 @@
outputs, outputs,
}: }:
let let
aqua = outputs.nixosConfigurations.kubevirt-youko.config; aqua = outputs.nixosConfigurations.youko.config;
in in
{ {
v2rayExporter = aqua.services.prometheus.exporters.v2ray.listenAddress; v2rayExporter = aqua.services.prometheus.exporters.v2ray.listenAddress;
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff. Show more