Files
nix-config/hosts/k8s/k3s-test-1-worker-2/default.nix
T
Ryan Yin 64cad91401 fix(k8s): unblock the k3s-test-1 workers
kubelet refuses to self-assign the reserved node-role.kubernetes.io/* labels, so the worker --node-label made the agent crash-loop. Drop it and rely on the masters' control-plane taint for placement; document that the taint only lands via registerWithTaints on first registration, so it was applied by hand here.
2026-09-23 12:07:28 +08:00

49 lines
1.3 KiB
Nix

{
config,
pkgs,
lib,
myvars,
mylib,
...
}:
let
hostName = "k3s-test-1-worker-2"; # Define your hostname.
coreModule = mylib.genMicrovmGuestModule {
inherit pkgs hostName;
inherit (myvars) networking;
vcpu = 4;
mem = 16384;
varSize = 20480;
};
k3sModule = mylib.genK3sAgentModule {
inherit pkgs;
tokenFile = config.age.secrets."k3s-test-1-token".path;
# use my own domain & kube-vip's virtual IP for the API server
# so that the API server can always be accessed even if some nodes are down
masterHost = "test-cluster-1.writefor.fun";
# Placement is enforced by the masters' control-plane taint. No node label:
# kubelet refuses to self-assign the reserved node-role.kubernetes.io/* labels.
};
in
{
imports =
(mylib.scanPaths ./.)
++ (map mylib.relativeToRoot [
"secrets/nixos.nix"
"modules/nixos/server/server.nix"
])
++ [
coreModule
k3sModule
];
# k3s-test-1-token lives in this secret group
modules.secrets.server.kubernetes.enable = true;
# The guest reuses the host's already-instantiated nixpkgs (shared store),
# so nixpkgs.config may not be set. The shared base modules set
# nixpkgs.config.allowUnfree, so force it empty here.
nixpkgs.config = lib.mkForce { };
}