Add k3s, move to subfolder
This commit is contained in:
parent
a423603e26
commit
0cf926e8fa
|
@ -69,6 +69,14 @@
|
||||||
tags = [ "website" "system" ];
|
tags = [ "website" "system" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
k3s = {
|
||||||
|
imports = [ ./machines/k3s ];
|
||||||
|
deployment = {
|
||||||
|
targetHost = "k3s.lxd";
|
||||||
|
tags = [ "k3s" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
29
nixos/machines/k3s/default.nix
Normal file
29
nixos/machines/k3s/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{ config, pkgs, lib, ... }: {
|
||||||
|
imports = [ ../../common ../../common/lxc.nix ];
|
||||||
|
networking.hostName = "k3s";
|
||||||
|
system.stateVersion = "21.11";
|
||||||
|
|
||||||
|
# Additional packages
|
||||||
|
environment.systemPackages = with pkgs; [ iptables vim ];
|
||||||
|
|
||||||
|
# Disable the firewall as we need all the ports
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# Force-enable Cgroupv2
|
||||||
|
systemd.enableUnifiedCgroupHierarchy = lib.mkForce true;
|
||||||
|
|
||||||
|
# Ensure `mount` and `grep` are available
|
||||||
|
systemd.services.k3s.path = [ pkgs.gnugrep pkgs.utillinux ];
|
||||||
|
|
||||||
|
# Enable k3s as a master node
|
||||||
|
services.k3s = {
|
||||||
|
enable = true;
|
||||||
|
role = "server";
|
||||||
|
|
||||||
|
extraFlags = builtins.toString [
|
||||||
|
"--data-dir=/var/lib/k3s" # Set data dir to var lib
|
||||||
|
"--cluster-init" # Enable embedded etcd
|
||||||
|
"--cluster-cidr=10.69.0.0/16" # the default of 10.42.0.0/16 clashes with my own network
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue