feat: hosts/k8s - fix k3s cidr (#200)

This commit is contained in:
Ryan Yin
2025-06-29 15:00:53 +08:00
committed by GitHub
parent aaabb5ed76
commit 0004bccc9d
14 changed files with 75 additions and 59 deletions

View File

@@ -3,6 +3,7 @@
masterHost,
tokenFile,
nodeLabels ? [],
k3sExtraArgs ? [],
...
}: let
package = pkgs.k3s;
@@ -10,7 +11,12 @@ in {
environment.systemPackages = [package];
# Kernel modules required by cilium
boot.kernelModules = ["ip6_tables" "ip6table_mangle" "ip6table_raw" "ip6table_filter"];
boot.kernelModules = [
"ip6_tables"
"ip6table_mangle"
"ip6table_raw"
"ip6table_filter"
];
networking.enableIPv6 = true;
networking.nat = {
enable = true;
@@ -29,7 +35,8 @@ in {
[
"--data-dir /var/lib/rancher/k3s"
]
++ (map (label: "--node-label=${label}") nodeLabels);
++ (map (label: "--node-label=${label}") nodeLabels)
++ k3sExtraArgs;
in
pkgs.lib.concatStringsSep " " flagList;
};

View File

@@ -11,6 +11,7 @@
masterHost,
clusterInit ? false,
kubeletExtraArgs ? [],
k3sExtraArgs ? [],
nodeLabels ? [],
nodeTaints ? [],
disableFlannel ? true,
@@ -35,7 +36,12 @@ in {
];
# Kernel modules required by cilium
boot.kernelModules = ["ip6_tables" "ip6table_mangle" "ip6table_raw" "ip6table_filter"];
boot.kernelModules = [
"ip6_tables"
"ip6table_mangle"
"ip6table_raw"
"ip6table_filter"
];
networking.enableIPv6 = true;
networking.nat = {
enable = true;
@@ -71,7 +77,8 @@ in {
++ (map (label: "--node-label=${label}") nodeLabels)
++ (map (taint: "--node-taint=${taint}") nodeTaints)
++ (map (arg: "--kubelet-arg=${arg}") kubeletExtraArgs)
++ (lib.optionals disableFlannel ["--flannel-backend=none"]);
++ (lib.optionals disableFlannel ["--flannel-backend=none"])
++ k3sExtraArgs;
in
lib.concatStringsSep " " flagList;
};