-
Clone the repo
Note: If operating behind corporate firewall, setup the proxy settings before continuing
git clone https://github.com/intel/kubevirt-gfx-sriov.git cd kubevirt-gfx-sriov
-
Add additional access to AppArmor libvirtd profile. This step is only required if the host OS (eg: Ubuntu) comes with AppArmor profile that is preventing KubeVirt operation. See issue for more detail
sudo cp apparmor/usr.sbin.libvirtd /etc/apparmor.d/local/ sudo systemctl reload apparmor.service
-
Install software dependency
sudo apt install curl -y
-
Install K3s. This step will setup a single node cluster where the host function as both the server/control plane and the worker node. This step is only required if you don't already have a Kubernetes cluster setup that you can use
*Note: K3s is a lightweight Kubernetes distribution suitable for Edge and IoT use cases.
./scripts/setuptools.sh -ik
-
Install KubeVirt and CDI
./scripts/setuptools.sh -iv
-
Install Krew and virt-plugin
Note: Get help on
setuptools.sh
by runningsetupstool.sh -h
./scripts/setuptools.sh -iw
-
After installation is completed, log out and log back in. Check K3s and KubeVirt have been successfully setup and deployed
Note: It might takes a few minutes for KubeVirt deployment to complete
kubectl get nodes kubectl get kubevirt -n kubevirt
Output:
NAME STATUS ROLES AGE VERSION ubuntu-host Ready control-plane,master 12m v1.24.4+k3s1 NAME AGE PHASE kubevirt 12m Deployed
-
Add systemd service unit file to enable graphics VFs on boot
sudo mkdir -p /var/vm/scripts sudo cp scripts/configvfs.sh /var/vm/scripts/ sudo chmod +x /var/vm/scripts/configvfs.sh sudo cp systemd/gfx-virtual-func.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl start gfx-virtual-func.service sudo systemctl enable gfx-virtual-func.service sudo reboot
-
Check the
configvfs.sh
log andgfx-virtual-func.service
daemon status for any errorsystemctl status gfx-virtual-func.service
Output:
gfx-virtual-func.service - Intel Graphics SR-IOV Virtual Function Manager Loaded: loaded (/etc/systemd/system/gfx-virtual-func.service; enabled; vendor preset: enabled) Active: active (exited) Process: 930 ExecStart=/bin/bash /var/vm/scripts/configvfs.sh -e (code=exited, status=0/SUCCESS) Main PID: 930 (code=exited, status=0/SUCCESS) CPU: 138ms ubuntu-host systemd[1]: Starting Intel Graphics SR-IOV Virtual Function Manager...
-
Update KubeVirt custom resource configuration to enable virt-handler to discover graphics VFs on the host. All discovered VFs will be published as allocatable resource
cd kubevirt-gfx-sriov kubectl apply -f manifests/kubevirt-cr-gfx-sriov.yaml
-
Check for presence of
intel.com/sriov-gpudevices
resourceNote: Please wait for all virt-handler pods to complete restarts using the following command:
kubectl get pods -n kubevirt
kubectl describe nodes
Output:
Capacity: intel.com/sriov-gpudevice: 7 Allocatable: intel.com/sriov-gpudevice: 7 Allocated resources: Resource Requests Limits -------- -------- ------ intel.com/sriov-gpudevice 0 0
Note: The value of Request and Limits will increase upon successful resource allocation to running pods/VMs
-
To uninstall all the components you can run the command below or you can specify which component to uninstall.
Note: Get help on
setuptools.sh
by runningsetupstool.sh -h
./scripts/setuptools.sh -u kvw