KubeVirt: Difference between revisions
| (13 intermediate revisions by the same user not shown) | |||
| Line 80: | Line 80: | ||
devices: | devices: | ||
disks: | disks: | ||
- bootOrder: 1 | - name: cdrom | ||
bootOrder: 1 | |||
cdrom: | cdrom: | ||
bus: sata | bus: sata | ||
- name: maindrive | - name: maindrive | ||
bootOrder: | bootOrder: 2 | ||
disk: | disk: | ||
bus: virtio | bus: virtio | ||
- name: windows-guest-tools | - name: windows-guest-tools | ||
bootOrder: | bootOrder: 3 | ||
cdrom: | cdrom: | ||
bus: sata | bus: sata | ||
interfaces: | interfaces: | ||
- | - name: nic-0 | ||
model: | model: virtio | ||
masquerade: {} | |||
sound: | sound: | ||
name: audio | name: audio | ||
| Line 109: | Line 109: | ||
persistentVolumeClaim: | persistentVolumeClaim: | ||
claimName: windows10vm-pvc | claimName: windows10vm-pvc | ||
- containerDisk: | - name: windows-guest-tools | ||
containerDisk: | |||
image: quay.io/kubevirt/virtio-container-disk | image: quay.io/kubevirt/virtio-container-disk | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | }} | ||
==vGPU== | ==vGPU== | ||
===Intel | ===Intel GVT-g=== | ||
This is deprecated. Additionally, I don't recommend this due to [https://github.com/intel/gvt-linux/issues/153 stability issues]. | |||
{{hidden | Instructions | | {{hidden | Instructions | | ||
See [https://kubevirt.io/2021/intel-vgpu-kubevirt.html#fedora-workstation-prep intel-vgpu-kubevirt] and [[Archwiki:Intel GVT-g]]. | |||
;Setup the nodes | ;Setup the nodes | ||
Run the following on each node with an Intel GPU. | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# Enable kvmgt and iommu | # Enable kvmgt and iommu | ||
| Line 133: | Line 136: | ||
pci_id=$(sudo lspci | grep -oP '([\d:\.]+)(?=\sVGA)') | pci_id=$(sudo lspci | grep -oP '([\d:\.]+)(?=\sVGA)') | ||
uuid1=$(uuidgen) | uuid1=$(uuidgen) | ||
cat > ~/gvtg-enable.service << EOF | cat > ~/gvtg-enable.service << EOF | ||
| Line 142: | Line 144: | ||
Type=oneshot | Type=oneshot | ||
ExecStart=/bin/sh -c "echo '${uuid1}' > /sys/devices/pci0000:00/0000:${pci_id}/mdev_supported_types/i915-GVTg_V5_8/create" | ExecStart=/bin/sh -c "echo '${uuid1}' > /sys/devices/pci0000:00/0000:${pci_id}/mdev_supported_types/i915-GVTg_V5_8/create" | ||
ExecStop=/bin/sh -c "echo '1' > /sys/devices/pci0000:00/0000:${pci_id}/${uuid1}/remove" | ExecStop=/bin/sh -c "echo '1' > /sys/devices/pci0000:00/0000:${pci_id}/${uuid1}/remove" | ||
RemainAfterExit=yes | RemainAfterExit=yes | ||
| Line 152: | Line 152: | ||
sudo mv ~/gvtg-enable.service /etc/systemd/system/gvtg-enable.service | sudo mv ~/gvtg-enable.service /etc/systemd/system/gvtg-enable.service | ||
sudo systemctl enable gvtg-enable --now | sudo systemctl enable gvtg-enable --now | ||
</syntaxhighlight> | |||
Notes | |||
* There are two sizes of vGPU you can create: | |||
** <code>i915-GVTg_V5_4</code> supports up to 1920x1200 | |||
** <code>i915-GVTg_V5_8</code> supports up to 1024x768 | |||
** See <code>cat /sys/devices/pci0000:00/0000:00:02.0/mdev_supported_types/i915-GVTg_V5_8/description</code> to get a description of the vgpu. | |||
** On my nodes, I can create a single <code>i915-GVTg_V5_4</code> or two <code>i915-GVTg_V5_8</code> | |||
* See [[Archwiki:Intel GVT-g]] for details | |||
;Add GPU to your VMs | |||
<syntaxhighlight lang="yaml"> | |||
spec: | |||
template: | |||
spec: | |||
domain: | |||
devices: | |||
gpus: | |||
- deviceName: intel.com/U630 | |||
name: gpu1 | |||
virtualGPUOptions: | |||
display: | |||
enabled: false | |||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | }} | ||
==Networking== | |||
===Bridge (Macvtap)=== | |||
This allows your VM to get an IP from the host network. | |||
# Install [https://github.com/k8snetworkplumbingwg/multus-cni multus-cni] | |||
# Enable macvtap [https://kubevirt.io/user-guide/operations/activating_feature_gates/#how-to-activate-a-feature-gate instructions] | |||
# Follow the remaining instructions [https://kubevirt.io/user-guide/virtual_machines/interfaces_and_networks/ here] | |||
==Resources== | ==Resources== | ||
* [https://kubevirt.io/api-reference/master/ KubeVirt API] | |||
* [https://kubevirt.io/2021/intel-vgpu-kubevirt.html#fedora-workstation-prep intel-vgpu-kubevirt] | * [https://kubevirt.io/2021/intel-vgpu-kubevirt.html#fedora-workstation-prep intel-vgpu-kubevirt] | ||