Skip to content

Instantly share code, notes, and snippets.

@veerendra2
Created November 13, 2022 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veerendra2/6688088c24b6f549a9a4d6aaf5396200 to your computer and use it in GitHub Desktop.
Save veerendra2/6688088c24b6f549a9a4d6aaf5396200 to your computer and use it in GitHub Desktop.
K8s-nvidia
Nvidia "Docker" Container Runtime
https://github.com/NVIDIA/nvidia-docker
Hashcat in Container
=====================
Nvidia in Docker - https://github.com/dizcza/docker-hashcat
Nvidia - K8s Docs
=================
https://docs.nvidia.com/datacenter/kubernetes-install-guide/index.html
nvidia-smi No devices were found on KVM VM
OS - Ubuntu Mate 18.04
RAM - 8GB
GPU - Nvidia GeForce GTX 1050Ti
Laptop - Acer Predator Helio 300
Secure Boot - Disabled
I followed [KVM : GPU Passthrough][1] guide to launch VM that should use GPU.
1. Updated grub config
GRUB_CMDLINE_LINUX="intel_iommu=on iommu=pt rd.driver.pre=vfio-pci video=efifb:off"
2. Added VFIO modules
veeru@ghost:~$ cat /etc/initram-fs/modules
vfio vfio_iommu_type1 vfio_pci vfio_virqfd
[1]: https://www.server-world.info/en/note?os=Ubuntu_18.04&p=kvm&f=11
GPU in VMs
==========
https://medium.com/@calerogers/gpu-virtualization-with-kvm-qemu-63ca98a6a172
https://www.server-world.info/en/note?os=Ubuntu_18.04&p=kvm&f=11
https://davidyat.es/2016/09/08/gpu-passthrough/#part-1-setting-up-passthrough
qemu-img create -f raw ubuntu14-HD.img 30G
sudo virt-install \
--name vm0 \
--ram 2028 \
--disk path=/home/veeru/ubuntu14-HD.img,size=30 \
--vcpus 2 \
--os-type linux \
--os-variant ubuntu16.04 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location /home/veeru/Downloads/ubuntu-16.04.5.iso --force \
--extra-args 'console=ttyS0,115200n8 serial'
sudo virt-install \
--name vm1 \
--memory 2028 \
--disk path=/home/veeru/ubuntu14-HD.img,size=30 \
--vcpus 2 \
--os-type linux \
--os-variant ubuntu16.04 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location /home/veeru/Downloads/ubuntu-16.04.5.iso --force \
--extra-args 'console=ttyS0,115200n8 serial' \
--host-device 01:00.0 \
--features kvm_hidden=on \
--machine q35
virsh nodedev-dumpxml pci_0000_01_00_0
<bus>1</bus>
<slot>0</slot>
<function>0</function>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0' bus='0x1' slot='0x0' function='0x0'/>
</source>
</hostdev>
virt-install --name spinnaker \
--ram 11096 \
--vcpus=4 \
--os-type linux \
--os-variant=ubuntutrusty \
--accelerate \
--nographics -v \
--disk path=/var/lib/libvirt/images/ubuntu14-HD.img,size=8 \
--extra-args "console=ttyS0" \
--location /opt/ubuntu14.iso --force \
--network bridge:virbr0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment