chore: remove the never-deployed k3s-prod-1 cluster (#284)

It was never bootstrapped (no flux deploy key, VMs commented out since
2024-10) and only carried a stale duplicate of the test cluster's config.

- hosts/k8s/k3s-prod-1-{master,worker}-{1,2,3} + flake outputs + the home module
- the k3s-prod-1-token agenix entry (the .age file lives in the private secrets repo)
- the k3s-prod-1-* IPs, the offlineHosts entries, the Justfile recipes and the docs
This commit is contained in:
ryan4yin | 二花 authored and GitHub committed 2026-09-21 12:53:43 +08:00
1 parent a4609501c4
commit 01c6b3290a
23 files changed
+20 -557

No files matched your search

-17
View File
@@ -256,18 +256,6 @@ kana mode="switch":
############################################################################
# Build and upload a vm image
[linux]
[group('homelab')]
upload-k3s-prod verbosity="normal":
#!/usr/bin/env nu
use {{utils_nu}} *;
upload-vm k3s-prod-1-master-1 {{verbosity}};
upload-vm k3s-prod-1-master-2 {{verbosity}};
upload-vm k3s-prod-1-master-3 {{verbosity}};
upload-vm k3s-prod-1-worker-1 {{verbosity}};
upload-vm k3s-prod-1-worker-2 {{verbosity}};
upload-vm k3s-prod-1-worker-3 {{verbosity}};
[linux]
[group('homelab')]
upload-k3s-test verbosity="normal":
@@ -277,11 +265,6 @@ upload-k3s-test verbosity="normal":
upload-vm k3s-test-1-master-2 {{verbosity}};
upload-vm k3s-test-1-master-3 {{verbosity}};
[linux]
[group('homelab')]
k3s-prod mode="switch":
colmena apply {{mode}} --on '@k3s-prod-*' --verbose --show-trace
[linux]
[group('homelab')]
k3s-test mode="switch":
+1 -1
View File
@@ -145,7 +145,7 @@ just local debug # detailed output (macOS has no switch/boot mode)
```
Remote / cluster hosts are deployed with [Colmena](https://github.com/zhaofengli/colmena) on top of
the same flake, e.g. `just col <tag>`, `just k3s-prod`, `just lab`.
the same flake, e.g. `just col <tag>`, `just k3s-test`, `just lab`.
> [What y'all will need when Nix drives you to drink.](https://www.youtube.com/watch?v=Eni9PPPPBpg)
> (copy from hlissner's dotfiles, it really matches my feelings when I first started using NixOS...)
-3
View File
@@ -1,3 +0,0 @@
{
imports = [ ../../linux/core.nix ];
}
+1 -2
View File
@@ -42,8 +42,7 @@ Named after "Twelve Kingdoms":
#### `k8s` - Kubernetes Infrastructure
- **KubeVirt Cluster**: 3 physical mini PCs (shoryu, shushou, youko) running all VMs
- **K3s Production**: 3 masters + 3 workers for production workloads
- **K3s Testing**: 3 masters for testing and development
- **K3s Testing**: 3 masters + 3 workers for testing and development
### External Systems
@@ -4,7 +4,7 @@
...
}:
let
# Powered-off hosts (SBCs, k3s-prod-1) plus shoukei (exporter disabled on the
# Powered-off hosts (SBCs) plus shoukei (exporter disabled on the
# machine); remove entries when they come back online.
offlineHosts = [
"shoukei"
@@ -15,12 +15,6 @@ let
"chiaya"
"rakushun"
"mitsuha"
"k3s-prod-1-master-1"
"k3s-prod-1-master-2"
"k3s-prod-1-master-3"
"k3s-prod-1-worker-1"
"k3s-prod-1-worker-2"
"k3s-prod-1-worker-3"
];
in
{
+9 -14
View File
@@ -2,7 +2,7 @@
> WIP, not finished yet.
I'm running two Kubernetes clusters, one for production and one for testing.
I'm running a Kubernetes cluster for testing and development.
I prefer to use [k3s] as the Kubernetes distribution, because it's lightweight, easy to install, and
full featured(see [what-have-k3s-removed-from-upstream-kubernetes] for details).
@@ -17,21 +17,16 @@ cluster, including other Kubernetes clusters.
## K3s Clusters
Clusters running as virtual machines on the KubeVirt cluster, for testing and production.
Clusters running as virtual machines on the KubeVirt cluster, for testing and development.
![](/_img/2024-02-18_k8s-nodes-overview.webp)
![](_img/2024-02-18_k8s-nodes-overview.webp)
1. For production:
1. `k3s-prod-1-master-1`
1. `k3s-prod-1-master-2`
1. `k3s-prod-1-master-3`
1. `k3s-prod-1-worker-1`
1. `k3s-prod-1-worker-2`
1. `k3s-prod-1-worker-3`
1. For testing:
1. `k3s-test-1-master-1`
2. `k3s-test-1-master-2`
3. `k3s-test-1-master-3`
1. `k3s-test-1-master-1`
1. `k3s-test-1-master-2`
1. `k3s-test-1-master-3`
1. `k3s-test-1-worker-1`
1. `k3s-test-1-worker-2`
1. `k3s-test-1-worker-3`
## Kubernetes Resources
-38
View File
@@ -1,38 +0,0 @@
{
config,
pkgs,
myvars,
mylib,
...
}:
let
hostName = "k3s-prod-1-master-1"; # Define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
inherit pkgs hostName;
inherit (myvars) networking;
};
k3sModule = mylib.genK3sServerModule {
inherit pkgs;
kubeconfigFile = "/home/${myvars.username}/.kube/config";
tokenFile = config.age.secrets."k3s-prod-1-token".path;
# the first node in the cluster should be the one to initialize the cluster
clusterInit = true;
# 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 = "prod-cluster-1.writefor.fun";
# k3sExtraArgs = [
# # IPv4 Private CIDR(full) - 172.16.0.0/12
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
# "--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}
-37
View File
@@ -1,37 +0,0 @@
{
config,
pkgs,
myvars,
mylib,
...
}:
let
hostName = "k3s-prod-1-master-2"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
inherit pkgs hostName;
inherit (myvars) networking;
};
k3sModule = mylib.genK3sServerModule {
inherit pkgs;
kubeconfigFile = "/home/${myvars.username}/.kube/config";
tokenFile = config.age.secrets."k3s-prod-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 = "prod-cluster-1.writefor.fun";
# k3sExtraArgs = [
# # IPv4 Private CIDR(full) - 172.16.0.0/12
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
# "--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}
-37
View File
@@ -1,37 +0,0 @@
{
config,
pkgs,
myvars,
mylib,
...
}:
let
hostName = "k3s-prod-1-master-3"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
inherit pkgs hostName;
inherit (myvars) networking;
};
k3sModule = mylib.genK3sServerModule {
inherit pkgs;
kubeconfigFile = "/home/${myvars.username}/.kube/config";
tokenFile = config.age.secrets."k3s-prod-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 = "prod-cluster-1.writefor.fun";
# k3sExtraArgs = [
# # IPv4 Private CIDR(full) - 172.16.0.0/12
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
# "--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}
-36
View File
@@ -1,36 +0,0 @@
{
config,
pkgs,
myvars,
mylib,
...
}:
let
hostName = "k3s-prod-1-worker-1"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
inherit pkgs hostName;
inherit (myvars) networking;
};
k3sModule = mylib.genK3sAgentModule {
inherit pkgs;
tokenFile = config.age.secrets."k3s-prod-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 = "prod-cluster-1.writefor.fun";
# k3sExtraArgs = [
# # IPv4 Private CIDR(full) - 172.16.0.0/12
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
# "--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}
-36
View File
@@ -1,36 +0,0 @@
{
config,
pkgs,
myvars,
mylib,
...
}:
let
hostName = "k3s-prod-1-worker-2"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
inherit pkgs hostName;
inherit (myvars) networking;
};
k3sModule = mylib.genK3sAgentModule {
inherit pkgs;
tokenFile = config.age.secrets."k3s-prod-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 = "prod-cluster-1.writefor.fun";
# k3sExtraArgs = [
# # IPv4 Private CIDR(full) - 172.16.0.0/12
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
# "--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}
-36
View File
@@ -1,36 +0,0 @@
{
config,
pkgs,
myvars,
mylib,
...
}:
let
hostName = "k3s-prod-1-worker-3"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
inherit pkgs hostName;
inherit (myvars) networking;
};
k3sModule = mylib.genK3sAgentModule {
inherit pkgs;
tokenFile = config.age.secrets."k3s-prod-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 = "prod-cluster-1.writefor.fun";
# k3sExtraArgs = [
# # IPv4 Private CIDR(full) - 172.16.0.0/12
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
# "--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}
+6 -6
View File
@@ -91,12 +91,12 @@ All the outputs of this flake are defined here.
│   ├── idols-aquamarine.nix
│   ├── idols-kana.nix
│   ├── idols-ruby.nix
│   ├── k3s-prod-1-master-1.nix
│   ├── k3s-prod-1-master-2.nix
│   ├── k3s-prod-1-master-3.nix
│   ├── k3s-prod-1-worker-1.nix
│   ├── k3s-prod-1-worker-2.nix
│   ├── k3s-prod-1-worker-3.nix
│ ├── k3s-test-1-master-1.nix
│ ├── k3s-test-1-master-2.nix
│ ├── k3s-test-1-master-3.nix
│ ├── k3s-test-1-worker-1.nix
│ ├── k3s-test-1-worker-2.nix
│ ├── k3s-test-1-worker-3.nix
│   ├── kubevirt-shoryu.nix
│   ├── kubevirt-shushou.nix
│   └── kubevirt-youko.nix
@@ -1,44 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
}@args:
let
name = "k3s-prod-1-master-1";
tags = [ name ];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
# common
"secrets/nixos.nix"
"modules/nixos/server/server.nix"
"modules/nixos/server/kubevirt-hardware-configuration.nix"
# host specific
"hosts/k8s/${name}"
])
++ [
{ modules.secrets.server.kubernetes.enable = true; }
];
home-modules = map mylib.relativeToRoot [
"home/hosts/linux/${name}.nix"
];
};
systemArgs = modules // args;
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.kubevirt;
}
@@ -1,41 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
}@args:
let
name = "k3s-prod-1-master-2";
tags = [ name ];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
# common
"secrets/nixos.nix"
"modules/nixos/server/server.nix"
"modules/nixos/server/kubevirt-hardware-configuration.nix"
# host specific
"hosts/k8s/${name}"
])
++ [
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.kubevirt;
}
@@ -1,41 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
}@args:
let
name = "k3s-prod-1-master-3";
tags = [ name ];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
# common
"secrets/nixos.nix"
"modules/nixos/server/server.nix"
"modules/nixos/server/kubevirt-hardware-configuration.nix"
# host specific
"hosts/k8s/${name}"
])
++ [
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.kubevirt;
}
@@ -1,41 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
}@args:
let
name = "k3s-prod-1-worker-1";
tags = [ name ];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
# common
"secrets/nixos.nix"
"modules/nixos/server/server.nix"
"modules/nixos/server/kubevirt-hardware-configuration.nix"
# host specific
"hosts/k8s/${name}"
])
++ [
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.kubevirt;
}
@@ -1,41 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
}@args:
let
name = "k3s-prod-1-worker-2";
tags = [ name ];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
# common
"secrets/nixos.nix"
"modules/nixos/server/server.nix"
"modules/nixos/server/kubevirt-hardware-configuration.nix"
# host specific
"hosts/k8s/${name}"
])
++ [
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.kubevirt;
}
@@ -1,41 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
}@args:
let
name = "k3s-prod-1-worker-3";
tags = [ name ];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
# common
"secrets/nixos.nix"
"modules/nixos/server/server.nix"
"modules/nixos/server/kubevirt-hardware-configuration.nix"
# host specific
"hosts/k8s/${name}"
])
++ [
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.kubevirt;
}
@@ -7,7 +7,7 @@ let
hosts = [
"ai-niri"
"ruby"
"k3s-prod-1-master-1"
"k3s-test-1-master-1"
];
in
lib.genAttrs hosts (_: "/home/${username}")
@@ -8,7 +8,7 @@ let
hosts = [
"ai-niri"
"ruby"
"k3s-prod-1-master-1"
"k3s-test-1-master-1"
];
in
lib.genAttrs hosts (
-5
View File
@@ -200,11 +200,6 @@ in
(mkIf cfg.server.kubernetes.enable {
age.secrets = {
"k3s-prod-1-token" = {
file = "${mysecrets}/server/k3s-prod-1-token.age";
}
// high_security;
"k3s-test-1-token" = {
file = "${mysecrets}/server/k3s-test-1-token.age";
}
-31
View File
@@ -104,37 +104,6 @@ rec {
# ============================================
# Kubernetes Clusters
# ============================================
k3s-prod-1-master-1 = {
# VM
iface = "enp2s0";
ipv4 = "192.168.5.108";
};
k3s-prod-1-master-2 = {
# VM
iface = "enp2s0";
ipv4 = "192.168.5.109";
};
k3s-prod-1-master-3 = {
# VM
iface = "enp2s0";
ipv4 = "192.168.5.110";
};
k3s-prod-1-worker-1 = {
# VM
iface = "enp2s0";
ipv4 = "192.168.5.111";
};
k3s-prod-1-worker-2 = {
# VM
iface = "enp2s0";
ipv4 = "192.168.5.112";
};
k3s-prod-1-worker-3 = {
# VM
iface = "enp2s0";
ipv4 = "192.168.5.113";
};
k3s-test-1-master-1 = {
# KubeVirt VM
iface = "enp2s0";