NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.42k stars 12.92k forks source link

k3s: GPU Passthrough for Nvidia / AMD / Intel #288037

Open superherointj opened 4 months ago

superherointj commented 4 months ago

This issue is for tracking GPU pass through in K3s.

K3s supports GPU pass through but not in NixOS K3s (last time I tried).

I don't know if it is a solved issue. I think it is not, but:

Last time I tried, I had issues with nix paths, ldcache in Nvidia driver. I got lost in the process. I will keep updating this issue until: GPU pass through is:

Other references:

SomeoneSerge commented 4 months ago

Related: https://github.com/NixOS/nixpkgs/pull/278969 https://github.com/NixOS/nixpkgs/pull/284507

OlfillasOdikno commented 1 month ago

I was unable to get the official NVIDIA device plugin to work, since all the heavy lifting is already done in containerd and generating cdi json, I created a device plugin that uses the cdi json and instructs kubernetes to inject the device. Tested it on a NVIDIA 3060. https://github.com/OlfillasOdikno/generic-cdi-plugin

ahirner commented 5 days ago

@OlfillasOdikno thanks, I use your plugin as well for now. I had problems that some containers didn't see libnvml.so.1, nor the generated CDIs.

GPU pass through is:

Question regarding scope: does this issue inlcude shared GPU use? I'm not sure how involved it is.