Added: k3s setup; Changed Firewall

This commit is contained in:
2026-02-18 16:35:01 +01:00
parent fc94e2f0af
commit ecf0d52f76
5 changed files with 71 additions and 9 deletions

View File

@@ -6,6 +6,7 @@
{
imports = [
./postgres.nix
./k3s-master.nix
];
# Any RPi 4 specific customizations go here
@@ -17,9 +18,5 @@
# prefixLength = 24;
# }
# ];
firewall = {
allowedTCPPorts = [ 5432 ];
};
};
}

View File

@@ -0,0 +1,38 @@
{ pkgs, ... }:
{
boot.kernelParams = [
"cgroup_memory=1"
"cgroup_enable=memory"
"cgroup_enable=cpuset"
];
services.k3s = {
enable = true;
role = "server";
clusterInit = true;
extraFlags = ''
--disable=traefik
--flannel-backend=host-gw
'';
};
networking.firewall = {
allowedTCPPorts = [ 6443 ];
allowedTCPPortRanges = [
{
from = 10250;
to = 10250;
}
{
from = 30000;
to = 32767;
}
];
trustedInterfaces = [ "cni0" ];
};
environment.systemPackages = with pkgs; [
kubectl
];
}

View File

@@ -63,6 +63,8 @@
# Enable the PostgreSQL service to start on boot
systemd.services.postgresql.wantedBy = [ "multi-user.target" ];
networking.firewall.allowedTCPPorts = [ 5432 ];
# Create mount point for external USB storage (optional, for better performance)
# Uncomment if using the USB 3 storage we configured earlier
# systemd.tmpfiles.rules = [

View File

@@ -4,7 +4,7 @@
}:
{
#imports = [ ];
imports = [ ../services/k3s-agent.nix ];
# Any RPi 4 specific customizations go here
networking = {
@@ -15,9 +15,5 @@
# prefixLength = 24;
# }
# ];
firewall = {
allowedTCPPorts = [ ];
};
};
}

View File

@@ -0,0 +1,29 @@
{ ... }:
{
boot.kernelParams = [
"cgroup_memory=1"
"cgroup_enable=memory"
"cgroup_enable=cpuset"
];
services.k3s = {
enable = true;
role = "agent";
serverAddr = "https://192.168.2.199:6443";
};
networking.firewall = {
allowedTCPPortRanges = [
{
from = 10250;
to = 10250;
}
{
from = 30000;
to = 32767;
}
];
trustedInterfaces = [ "cni0" ];
};
}