Skip to content

Instantly share code, notes, and snippets.

@michalhosna
Last active April 6, 2020 19:20
Show Gist options
  • Select an option

  • Save michalhosna/a67287cb269aff0406cdfb0222209ed9 to your computer and use it in GitHub Desktop.

Select an option

Save michalhosna/a67287cb269aff0406cdfb0222209ed9 to your computer and use it in GitHub Desktop.
Nix for kubernetes
{ config, pkgs, ... }:
let
kubeMasterHostname = "master.boson";
kubeMasterAPIServerPort = 8443;
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
boot.loader.grub = {
enable = true;
version = 2;
device = "/dev/sda";
};
networking.interfaces.ens18.useDHCP = true;
networking.hostName = kubeMasterHostname;
time.timeZone = "Europe/Prague";
environment.systemPackages = with pkgs; [
curl
vim
kubectl
kubernetes
];
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE16tyPtsIHOPzwbYIZCJ1iRJOYQMyloscgvq4Kq4RoU Michal Hošna<mh@michalhosna>"];
networking.firewall.enable = false;
services.kubernetes = {
roles = ["master" "node"];
masterAddress = kubeMasterHostname;
easyCerts = true;
apiserver = {
securePort = kubeMasterAPIServerPort;
#advertiseAddress = kubeMasterIP;
};
# use coredns
addons.dns.enable = true;
};
services.qemuGuest.enable = true;
system.stateVersion = "19.09";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment