{ pkgs, config, lib, ... }: let cfg = config.z34.kube-node; in { options.z34.kube-node = with lib; { enable = mkEnableOption "Enable kube-node"; master-ip = mkOption { type = types.str; default = "127.0.0.1"; description = "IP Address of the kube-node"; }; master-hostname = mkOption { type = types.str; default = "api.kube"; description = "Hostname of the kube-node"; }; master-api-server-port = mkOption { type = types.int; default = 6443; description = "Port of the kube-node API server"; }; }; config = lib.mkIf cfg.enable { # resolve master hostname networking.extraHosts = "${cfg.master-ip} ${cfg.master-hostname}"; # packages for administration tasks environment.systemPackages = with pkgs; [ kompose kubectl kubernetes ]; services.kubernetes = let apiUrl = "https://${cfg.master-hostname}:${toString cfg.master-api-server-port}"; in { roles = [ "node" ]; masterAddress = cfg.master-hostname; easyCerts = true; kubelet.kubeconfig.server = apiUrl; apiserverAddress = apiUrl; # use coredns addons.dns.enable = true; # needed if you use swap kubelet.extraOpts = "--fail-swap-on=false"; }; }; imports = [ ]; }