K8S
This commit is contained in:
1 parent
73e98c99f3
commit
a320dec5ff
4 files changed
+76
No files matched your search
@@ -8,5 +8,6 @@
|
||||
./jellyfin.nix
|
||||
./admin.nix
|
||||
./arrs
|
||||
./k8s
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.skyg.nixos.server.k8s;
|
||||
in
|
||||
{
|
||||
import = [
|
||||
./master.nix
|
||||
./node.nix
|
||||
];
|
||||
options = {
|
||||
skyg.nixos.server.k8s = {
|
||||
enable = lib.mkEnableOption
|
||||
"Enable K8s";
|
||||
isMaster = lib.mkEnableOption
|
||||
"Enable as master";
|
||||
masterIP = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
masterHostName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
masterAPIPort = lib.mkOption {
|
||||
type = lib.types.number;
|
||||
default = 6443;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# resolve master hostname
|
||||
networking.extraHosts = "${cfg.masterIP} ${cfg.masterHostName}";
|
||||
|
||||
# packages for administration tasks
|
||||
environment.systemPackages = with pkgs; [
|
||||
kompose
|
||||
kubectl
|
||||
kubernetes
|
||||
];
|
||||
services.kubernetes = {
|
||||
masterAddress = cfg.masterHostName;
|
||||
easyCerts = true;
|
||||
apiserverAddress = "https://${cfg.masterHostName}:${toString cfg.masterAPIPort}";
|
||||
addons.dns.enable = true;
|
||||
kubelet.extraOpts = "--fail-swap-on=false";
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.skyg.nixos.server.k8s;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (cfg.enable && cfg.isMaster) {
|
||||
services.kubernetes = {
|
||||
roles = [ "master" "node" ];
|
||||
apiserver = {
|
||||
securePort = cfg.masterAPIPort;
|
||||
advertiseAddress = cfg.masterIP;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.skyg.nixos.server.k8s;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (cfg.enable && (!cfg.isMaster)) {
|
||||
services.kubernetes = {
|
||||
roles = [ "node" ];
|
||||
kubelet.kubeconfig.server = "https://${cfg.masterHostName}:${toString cfg.masterAPIPort}";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user