This article will review a basic installation of KubeVirt on BCM 10 or later. These steps will not work for BCM 9.2 and earlier. This will be based on the instructions on the KubeVirt installation page and may change over time.
Install libvirt packages on all worker nodes
There are two steps to installing the packages on the worker node. The first is to install the packages into the software image and the second is to reboot the nodes to make sure the images are updated.
Installing the packages in the software image
# cm-chroot-sw-img /cm/image/<imagename> # dnf install libvirt
On Ubuntu images the package installation will look like the following
# apt update # apt install libvirt-daemon
Reboot the nodes
# cmsh % device % reboot -n node001..node003
Install Kubernetes
Kubernetes should be installed using the cm-kubernetes-setup tools.
Install KubeVirt
Based on the most recent documentation the installation of KubeVirt will look like the following
# module load kubernetes # export RELEASE=$(curl https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirt/stable.txt) # kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/kubevirt-operator.yaml # kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/kubevirt-cr.yaml # kubectl -n kubevirt wait kv kubevirt --for condition=Available
It may take some time before the kubevirt API becomes available for use.
# kubectl -n kubevirt wait kv kubevirt --for condition=Available kubevirt.kubevirt.io/kubevirt condition met
Testing
Create the following file as test.yaml
apiVersion: kubevirt.io/v1 kind: VirtualMachineInstance metadata: name: testvmi-nocloud spec: terminationGracePeriodSeconds: 30 domain: resources: requests: memory: 1024M devices: disks: - name: containerdisk disk: bus: virtio - name: emptydisk disk: bus: virtio - disk: bus: virtio name: cloudinitdisk volumes: - name: containerdisk containerDisk: image: kubevirt/fedora-cloud-container-disk-demo:latest - name: emptydisk emptyDisk: capacity: "2Gi" - name: cloudinitdisk cloudInitNoCloud: userData: |- #cloud-config password: fedora chpasswd: { expire: False }
You can then apply it with the following commands. The password for the host is in the userdata from the yaml.
# kubectl apply -f test.yaml virtualmachineinstance.kubevirt.io/testvmi-nocloud created # kubectl get vmi NAME AGE PHASE IP NODENAME READY testvmi-nocloud 2m8s Running 172.29.112.148 node002 True # ssh fedora@172.29.112.148 Warning: Permanently added '172.29.112.148' (ECDSA) to the list of known hosts. fedora@172.29.112.148's password: [fedora@testvmi-nocloud ~]$ more /etc/os-release NAME=Fedora VERSION="32 (Cloud Edition)" ID=fedora VERSION_ID=32 VERSION_CODENAME="" PLATFORM_ID="platform:f32" PRETTY_NAME="Fedora 32 (Cloud Edition)" ANSI_COLOR="0;34" LOGO=fedora-logo-icon CPE_NAME="cpe:/o:fedoraproject:fedora:32" HOME_URL="https://fedoraproject.org/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/" SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=32 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=32 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" VARIANT="Cloud Edition" VARIANT_ID=cloud [fedora@testvmi-nocloud ~]$