talos icon indicating copy to clipboard operation
talos copied to clipboard

GPU Passthrough

Open anjuls opened this issue 10 months ago • 3 comments

Feature Request

We want to use Talos on bare metal and in our use case, we run KubeVirt VMs on top of Talos that require GPU passthrough.

Description

To use GPUs in KubeVirt, we can either do virtual GPU (fractional) or full GPU via PCI passthrough. I don't see any documentation in Talos, on how to do this.

https://kubevirt.io/user-guide/virtual_machines/host-devices/

anjuls avatar Apr 25 '24 18:04 anjuls

There is no specific guide for Talos Linux, but you can contribute one.

Some notes:

  • adding extra kernel args in Talos Linux is handled either by:
    • if booting from a disk image, pre-generating one via Image Factory with custom kernel args
    • if booting from e.g. an ISO/PXE, putting extra args to machine.install.extraKernelArgs in the machine config
    • for existing nodes, via machine.install.extraKernelArgs followed by an upgrade (even to the same version)
  • writing to /sys (sysfs) can be handled via machine.sysfs

smira avatar Apr 26 '24 11:04 smira

I successfully managed to use GPU passthrough with KubeVirt by setting:

machine:
  install:
    extraKernelArgs:
      - amd_iommu=on
      - vfio-pci.ids=1002:73bf

The procedure is the same as using any other Linux distro. The Arch wiki has a detailed article on the topic.

DamiaPoquet avatar Apr 26 '24 12:04 DamiaPoquet

Thanks @smira and @DamiaPoquet

anjuls avatar Apr 29 '24 14:04 anjuls