[NixOS] Fix cdi issues with k3s containerd
This commit is contained in:
parent
bb259bf358
commit
618f927cb9
@ -1,4 +1,4 @@
|
|||||||
{ config, lib, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let cfg = config.myModules.railbird-k3s;
|
let cfg = config.myModules.railbird-k3s;
|
||||||
in {
|
in {
|
||||||
@ -22,19 +22,20 @@ in {
|
|||||||
enableDelete = true;
|
enableDelete = true;
|
||||||
enableGarbageCollect = true;
|
enableGarbageCollect = true;
|
||||||
};
|
};
|
||||||
virtualisation.containerd = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
plugins."io.containerd.grpc.v1.cri" = {
|
|
||||||
enable_cdi = true;
|
|
||||||
cdi_spec_dirs = [ "/var/run/cdi" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
services.k3s = {
|
services.k3s = {
|
||||||
enable = true;
|
enable = true;
|
||||||
clusterInit = cfg.serverAddr == "";
|
clusterInit = cfg.serverAddr == "";
|
||||||
serverAddr = cfg.serverAddr;
|
serverAddr = cfg.serverAddr;
|
||||||
|
configPath = pkgs.writeTextFile {
|
||||||
|
name = "k3s-config.yaml";
|
||||||
|
text = ''
|
||||||
|
write-kubeconfig-mode: "0644"
|
||||||
|
kubelet-arg:
|
||||||
|
- "eviction-hard=nodefs.available<2Gi"
|
||||||
|
- "eviction-soft=nodefs.available<5Gi"
|
||||||
|
- "eviction-soft-grace-period=nodefs.available=5m"
|
||||||
|
'';
|
||||||
|
};
|
||||||
tokenFile = config.age.secrets."1896Folsom-k3s-token.age".path;
|
tokenFile = config.age.secrets."1896Folsom-k3s-token.age".path;
|
||||||
extraFlags = [
|
extraFlags = [
|
||||||
"--tls-san ryzen-shine.local"
|
"--tls-san ryzen-shine.local"
|
||||||
@ -47,6 +48,9 @@ in {
|
|||||||
containerdConfigTemplate = ''
|
containerdConfigTemplate = ''
|
||||||
{{ template "base" . }}
|
{{ template "base" . }}
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
"io.containerd.grpc.v1.cri".enable_cdi = true
|
||||||
|
|
||||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia]
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia]
|
||||||
privileged_without_host_devices = false
|
privileged_without_host_devices = false
|
||||||
runtime_engine = ""
|
runtime_engine = ""
|
||||||
|
@ -4,7 +4,10 @@ makeEnable config "myModules.nvidia" false {
|
|||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
nvidia-container-toolkit
|
nvidia-container-toolkit
|
||||||
];
|
];
|
||||||
hardware.nvidia-container-toolkit.enable = true;
|
hardware.nvidia-container-toolkit = {
|
||||||
|
enable = true;
|
||||||
|
mount-nvidia-executables = true;
|
||||||
|
};
|
||||||
hardware.nvidia.open = false;
|
hardware.nvidia.open = false;
|
||||||
hardware.graphics.extraPackages = [ pkgs.linuxPackages.nvidia_x11.out ];
|
hardware.graphics.extraPackages = [ pkgs.linuxPackages.nvidia_x11.out ];
|
||||||
hardware.graphics.extraPackages32 = [ pkgs.linuxPackages.nvidia_x11.lib32 ];
|
hardware.graphics.extraPackages32 = [ pkgs.linuxPackages.nvidia_x11.lib32 ];
|
||||||
|
Loading…
Reference in New Issue
Block a user