-
-
Save cawa0505/e501edbd8bd9e8922dfe8fa354872d75 to your computer and use it in GitHub Desktop.
NixOS Configuration for experimental K3S cluster node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, ... }: | |
{ | |
imports = | |
[ # Include the results of the hardware scan. | |
./hardware-configuration.nix | |
]; | |
# Use the systemd-boot EFI boot loader. | |
boot.loader.systemd-boot.enable = true; | |
boot.loader.efi.canTouchEfiVariables = true; | |
# Hostname of the node | |
networking.hostName = "nuc6"; | |
# Networking | |
systemd.network.enable = true; | |
systemd.network.networks."10-lan" = { | |
matchConfig.Name = "eno1"; | |
networkConfig.DHCP = "ipv4"; | |
}; | |
# Nice font for the framebuffer console | |
console = { | |
earlySetup = true; | |
font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; | |
packages = with pkgs; [ terminus_font ]; | |
keyMap = "us"; | |
}; | |
# Define a user account. Don't forget to set a password with ‘passwd’. | |
users.users.alice = { | |
isNormalUser = true; | |
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. | |
packages = with pkgs; [ | |
dmidecode | |
tmux | |
asciiquarium | |
k9s | |
]; | |
}; | |
# Additional packages | |
environment.systemPackages = with pkgs; [ | |
fluxcd | |
k3s | |
kubectl | |
kubernetes-helm | |
vim | |
]; | |
# Enable the OpenSSH daemon. | |
services.openssh.enable = true; | |
# Firewall openings | |
networking.firewall.allowedTCPPorts = [ | |
22 # SSH | |
2342 # random port | |
6443 # Kubernetes | |
]; | |
# NixOS state version | |
system.stateVersion = "23.05"; | |
# K3S Kubernetes | |
services.k3s.enable = true; | |
services.k3s.role = "server"; | |
# Fix issue with "too many open files" | |
security.pam.loginLimits = [{ | |
domain = "*"; | |
type = "soft"; | |
item = "nofile"; | |
value = "8192"; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment