Making sure that k8s is properly distributed
This commit is contained in:
1 parent
9f120c4352
commit
3f1b8a2b3e
6 files changed
+45
-22
No files matched your search
+2
-2
@@ -25,8 +25,8 @@
|
||||
skyg.networkDrives.enable = enableNetworkDrives;
|
||||
skyg.nixos.common.containers = (if os.enable then os.containers else { });
|
||||
skyg.nixos.server.k8s = {
|
||||
masterIP = "10.0.10.6";
|
||||
masterHostName = "minipc1.lab.internal";
|
||||
masterIP = "10.0.10.8";
|
||||
masterHostName = "terra1.lab.internal";
|
||||
};
|
||||
system.stateVersion = systemStateVersion;
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
@@ -26,22 +26,39 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# resolve master hostname
|
||||
networking.extraHosts = "${cfg.masterIP} ${cfg.masterHostName}";
|
||||
|
||||
# packages for administration tasks
|
||||
environment.systemPackages = with pkgs; [
|
||||
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";
|
||||
config =
|
||||
let
|
||||
ports = [
|
||||
cfg.masterAPIPort # k8s api server
|
||||
10250 # kubelet api
|
||||
10259 # kubelet scheduler
|
||||
10257 # kubelet controller
|
||||
8888 # no idea what this is
|
||||
];
|
||||
portRanges = [
|
||||
{ from = 2379; to = 2380; } # etcd
|
||||
];
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
# resolve master hostname
|
||||
networking.extraHosts = "${cfg.masterIP} ${cfg.masterHostName}";
|
||||
networking.firewall.allowedUDPPorts = ports;
|
||||
networking.firewall.allowedUDPPortRanges = portRanges;
|
||||
networking.firewall.allowedTCPPorts = ports;
|
||||
networking.firewall.allowedTCPPortRanges = portRanges;
|
||||
|
||||
# packages for administration tasks
|
||||
environment.systemPackages = with pkgs; [
|
||||
kubectl
|
||||
kubernetes
|
||||
];
|
||||
services.kubernetes = {
|
||||
proxy.hostname = cfg.masterHostName;
|
||||
masterAddress = cfg.masterHostName;
|
||||
easyCerts = true;
|
||||
apiserverAddress = "https://${cfg.masterHostName}:${toString cfg.masterAPIPort}";
|
||||
addons.dns.enable = true;
|
||||
kubelet.extraOpts = "--fail-swap-on=false";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -5,13 +5,11 @@ in
|
||||
{
|
||||
config = lib.mkIf (cfg.enable && cfg.isMaster) {
|
||||
services.kubernetes = {
|
||||
roles = [ "master" "node" ];
|
||||
roles = [ "master" ];
|
||||
apiserver = {
|
||||
securePort = cfg.masterAPIPort;
|
||||
advertiseAddress = cfg.masterIP;
|
||||
};
|
||||
};
|
||||
networking.firewall.allowedUDPPorts = [ cfg.masterAPIPort ];
|
||||
networking.firewall.allowedTCPPorts = [ cfg.masterAPIPort ];
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user