unified cluster setup using colmena

This commit is contained in:
Jonas Juselius
2022-09-09 11:00:55 +02:00
parent ff19c52fd1
commit 980364adee
61 changed files with 966 additions and 117 deletions

152
cluster/nfs1/default.nix Normal file
View File

@@ -0,0 +1,152 @@
{ pkgs ? import <nixpkgs> {} }:
let
# Pin the deployment package-set to a specific version of nixpkgs
# pkgs = import (builtins.fetchTarball {
# url = "https://github.com/NixOS/nixpkgs/archive/e9148dc1c30e02aae80cc52f68ceb37b772066f3.tar.gz";
# sha256 = "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
# }) {};
# pkgs = import <nixpkgs> {};
etcdCluster = import ../etcdCluster.nix;
name = "nfs1";
address = "10.255.241.90";
in {
nfs1 = { config, pkgs, ... }: with pkgs; {
deployment.tags = [ "fs" "fs-work" ];
deployment.targetHost = address;
system.autoUpgrade.enable = lib.mkForce false;
systemd.targets = {
sleep.enable = false;
suspend.enable = false;
hibernate.enable = false;
hybrid-sleep.enable = false;
};
services.udev.extraRules = ''
KERNEL=="ibp65s0", SUBSYSTEM=="net", ATTR{create_child}:="0x7666"
'';
environment.systemPackages = with pkgs; [
rdma-core
hwloc
];
cluster.k8sNode = true;
features = {
host = {
inherit address;
inherit name;
};
os = {
externalInterface = "enp33s0f3np3";
nfs.enable = true;
nfs.exports = ''
/exports 10.255.241.0/24(insecure,rw,async,no_subtree_check,crossmnt,fsid=0,no_root_squash)
/exports 10.255.243.0/24(insecure,rw,async,no_subtree_check,crossmnt,fsid=0,no_root_squash)
'';
};
k8s = {
enable = true;
node.enable = true;
master.enable = false;
inherit etcdCluster;
};
};
# services.kubernetes.kubelet.extraSANs = mkSANs {
# name = cfg.name;
# address = cfg.address;
# };
systemd.services.rc-local = {
description = "rc.local script";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
path = [ "/run/current-system/sw/" ];
serviceConfig = {
Type = "oneshot";
};
script = ''
# if [ -e /sys/block/md126 ]; then
# echo "deadline" > /sys/block/md126/queue/scheduler
# # echo "4096" > /sys/block/md126/queue/nr_requests
# echo "4096" > /sys/block/md126/queue/read_ahead_kb
# echo "always" > /sys/kernel/mm/transparent_hugepage/enabled
# echo "always" > /sys/kernel/mm/transparent_hugepage/defrag
# fi
grep -q rdma /proc/fs/nfsd/portlist || echo "rdma 20049" > /proc/fs/nfsd/portlist
'';
};
boot.kernel.sysctl = {
"vm.dirty_background_ratio" = 5;
"vm.dirty_ratio" = 10;
"vm.vfs_cache_pressure" = 50;
"vm.min_free_kbytes" = 262144;
};
networking = {
hostName = name;
interfaces.enp33s0f3np3 = {
useDHCP = false;
ipv4.addresses = [ {
address = address;
prefixLength = 24;
} ];
ipv4.routes = [ {
address = "10.255.242.2";
prefixLength = 32;
via = "10.255.241.100";
} ];
};
interfaces."ibp65s0" = {
useDHCP = false;
};
interfaces."ibp65s0.7666" = {
useDHCP = false;
ipv4.addresses = [ {
address = "10.255.243.90";
prefixLength = 24;
} ];
};
firewall = {
allowedTCPPorts = [];
allowedUDPPorts = [];
extraCommands = ''
iptables -I INPUT -s 10.255.241.0/24 -j ACCEPT
iptables -I INPUT -s 10.255.243.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.255.243.0/24 -j MASQUERADE
'';
};
};
fileSystems = {
"/exports/work" = {
device = "/work";
options = [ "bind" ];
};
"/exports/data" = {
device = "/data";
options = [ "bind" ];
};
"/exports/opt" = {
device = "/opt";
options = [ "bind" ];
};
# "/vol/local-storage/vol1" = {
# device = "/vol/vol1";
# options = [ "bind" ];
# };
};
programs.singularity.enable = true;
imports = [
../cluster.nix
./hardware-configuration.nix
];
};
}

View File

@@ -0,0 +1,49 @@
# 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, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "megaraid_sas" "xhci_pci" "ahci" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/19d00648-5fbd-4464-93a0-e013d7f79d3a";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/68AF-2717";
fsType = "vfat";
};
fileSystems."/data" =
{ device = "/dev/disk/by-uuid/bf1bede5-bc60-4603-874c-88ed85e6ab5f";
fsType = "ext4";
};
fileSystems."/work" =
{ device = "/dev/disk/by-uuid/31552727-950f-4b3a-91fc-5af6b989b1d3";
fsType = "xfs";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp33s0f0np0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp33s0f1np1.useDHCP = lib.mkDefault true;
# networking.interfaces.enp33s0f2np2.useDHCP = lib.mkDefault true;
# networking.interfaces.enp33s0f3np3.useDHCP = lib.mkDefault true;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

1
cluster/nfs1/nfs1.pub Normal file
View File

@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC/a5Q1Y8hta/v8W/cM45o6UimPLfSzz6NM+WaNAYbwnLoz2VVowHdjyndajmH1CMK/cTDRiVSrTkky48f3JNKzCMjmwVA6PjWmRxF0tqcitW9hzFB+L10+fgBsZu7MUMhuWfTtekIgnRjqNZIA3q5PGz9JrMHsRem+RGmDayaNSAkOZ1ToGSS7pnGm06qAswLJaK15wnupw5x9NYO1RXq2Dy2pX68e4urA+h9X9tqDfb6kQP3/9gb+q6BpiGUwUHW5x0HK/LwNqThKV7ZwzgMHqz4rq5TieGemTw8LKcDjj3BWQTDt4SlZ2gux49C7z1vBipHtxKHIdZH9AXYPZCkjgI/OVVJvxkbgMM+3FSr3j/KvTOdL5ycJvGBsF4dJnRTTpay7OmnksQ62+vwNO2dvDnhAgVntrr9Fb1ahLnTN7dOf6BlkUbz+vtYby0gcjr5sW8b4duGpJThDDkAGLUKkx1z94/bpPQpUb1ajXPizO7jjJCK20zTXWG2uiOdXWHmZ3YVoJ/qSOvtUAX2RR2FgJzHqnDnHtmLiMc9OkZ0eJwo6ltBqGHPNXCyBwHAa8eSH2Af+10vfzJ88J8MGD88DV7SYWbJxuB+KMAnDX04UfrvqLnRADzbFuiG8locorXFE90wEZTz/nFWsM+Q/XPA+M1GaO6fK9SyN45LgApKARQ== root@nfs1