Make things more configurable
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
with import <nixpkgs> {};
|
||||
let
|
||||
settings = rec {
|
||||
clusterName = "kube1";
|
||||
master = "k1-0";
|
||||
workers = [ "k1-1" "k1-2" ];
|
||||
masterAddress = "10.253.18.109";
|
||||
apiserverAddress = "https://${masterAddress}:8443";
|
||||
apiserverAddress = "https://${masterAddress}:4443";
|
||||
clusterHosts = ''
|
||||
10.253.18.109 k1-0 kubernetes fs0-2
|
||||
10.253.18.110 k1-1
|
||||
|
||||
22
clusters/template/default.nix
Normal file
22
clusters/template/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
with import <nixpkgs> {};
|
||||
let
|
||||
settings = rec {
|
||||
master = "node1";
|
||||
workers = [ "node2" ];
|
||||
masterAddress = "10.10.10.1";
|
||||
apiserverAddress = "https://${masterAddress}:4443";
|
||||
clusterHosts = ''
|
||||
10.10.10.1 node1 kubernetes
|
||||
10.10.10.2 node2
|
||||
10.10.20.1 fs1
|
||||
'';
|
||||
adminAuthorizedKeys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKiAS30ZO+wgfAqDE9Y7VhRunn2QszPHA5voUwo+fGOf admin"
|
||||
];
|
||||
};
|
||||
cluster = callPackage ../../lib/k8s.nix { here = ./.; inherit settings; };
|
||||
in
|
||||
{
|
||||
node1 = cluster.apiserver "10.10.10.1" "node1";
|
||||
node2 = cluster.worker "10.10.10.2" "node2";
|
||||
}
|
||||
21
clusters/template/node1.nix
Normal file
21
clusters/template/node1.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "mptspi" "floppy" "sd_mod" "sr_mod" ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
nix.maxJobs = lib.mkDefault 1;
|
||||
}
|
||||
21
clusters/template/node2.nix
Normal file
21
clusters/template/node2.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "mptspi" "floppy" "sd_mod" "sr_mod" ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
nix.maxJobs = lib.mkDefault 1;
|
||||
}
|
||||
Reference in New Issue
Block a user