From 423e889790af8f776eb3c1e18bdf05e26bf65ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sun, 15 Nov 2026 17:49:10 +0100 Subject: [PATCH] k3s on pc2 --- nixosConfigurations/muede-pc2/default.nix | 1 + .../muede-pc2/k8s-test-swarm.nix | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 nixosConfigurations/muede-pc2/k8s-test-swarm.nix diff --git a/nixosConfigurations/muede-pc2/default.nix b/nixosConfigurations/muede-pc2/default.nix index 706e528..6ea8bc7 100644 --- a/nixosConfigurations/muede-pc2/default.nix +++ b/nixosConfigurations/muede-pc2/default.nix @@ -4,6 +4,7 @@ ./hardware.nix ./gitea-runner.nix ./hive-ci-runner.nix + ./k8s-test-swarm.nix # ./vscode-server.nix # ./hass.nix ]; diff --git a/nixosConfigurations/muede-pc2/k8s-test-swarm.nix b/nixosConfigurations/muede-pc2/k8s-test-swarm.nix new file mode 100644 index 0000000..dc5ada8 --- /dev/null +++ b/nixosConfigurations/muede-pc2/k8s-test-swarm.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: +{ + # Test swarm for hyperhive's move to k8s. pc2 is the only node for now. + # + # kubectl get nodes (as muede, via /etc/rancher/k3s/k3s.yaml) + # + # Adding a node later: set `services.k3s.token`/`tokenFile` here, open + # 6443/tcp, 2379-2380/tcp and 8472/udp, then point the new node's + # `serverAddr` at pc2. `clusterInit` already makes this an embedded-etcd + # server so it can grow into an HA control plane. + services.k3s = { + enable = true; + role = "server"; + clusterInit = true; + + # No ingress/LB baked in: hyperhive brings its own, and servicelb would + # otherwise grab 80/443 on a desktop. + disable = [ + "traefik" + "servicelb" + ]; + + extraFlags = [ + # admin kubeconfig readable by wheel, not the whole machine + "--write-kubeconfig-mode=0640" + "--write-kubeconfig-group=wheel" + ]; + }; + + environment = { + systemPackages = with pkgs; [ + kubectl + kubernetes-helm + k9s + ]; + sessionVariables.KUBECONFIG = "/etc/rancher/k3s/k3s.yaml"; + }; +}