feat: new k3s cluster

This commit is contained in:
Ryan Yin
2024-02-18 13:49:28 +08:00
parent 1a3b02a062
commit c19184a6be
27 changed files with 508 additions and 68 deletions
+17
View File
@@ -0,0 +1,17 @@
{
vars_networking,
mylib,
...
}: let
hostName = "k3s-prod-1-worker-2"; # Define your hostname.
k8sLib = import ../lib.nix;
coreModule = k8sLib.genCoreModule {
inherit hostName vars_networking;
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
];
}
+21
View File
@@ -0,0 +1,21 @@
{
config,
pkgs,
vars_networking,
...
}: let
serverName = "k3s-prod-1-master-1";
serverIp = vars_networking.hostAddress.${serverName}.address;
package = pkgs.k3s_1_29;
in {
environment.systemPackages = [package];
services.k3s = {
inherit package;
enable = true;
role = "agent";
serverAddr = "https://${serverIp}:6443";
tokenFile = config.age.secrets."k3s-prod-1-token".path;
# https://docs.k3s.io/cli/agent
extraFlags = "--data-dir /var/lib/rancher/k3s";
};
}