Migrate a sample Windows workload to Kubernetes using KubeVirt and CDI
The goal of this blog is to demonstrate that a web service can continue to run after a Windows guest virtual machine providing the service is migrated from MS Windows and Oracle VirtualBox to a guest virtual machine orchestrated by Kubernetes and KubeVirt on a Fedora Linux host. Yes! It can be done!
Source details
- Host platform: Windows 2019 Datacenter
- Virtualization platform: Oracle VirtualBox 6.1
- Guest platform: Windows 2019 Datacenter (guest to be migrated) 1
- Guest application: My favorite dotnet application Jellyfin
Target details
- Host platform: Fedora 32 with latest updates applied
- Kubernetes cluster created
- KubeVirt and CDI installed in the Kubernetes cluster.
Procedure
Tasks to performed on source host
- Before we begin let's take a moment to ensure the service is running and
web browser accessible
- Power down the guest virtual machine to ensure all changes to the
filesystem are quiesced to disk.
VBoxManage.exe controlvm testvm poweroff
- Upload the guest virtual machine disk image to the Kubernetes cluster
and a target DataVolume called testvm
2
virtctl.exe image-upload dv testvm --size=14Gi --image-path="C:\Users\Administrator\VirtualBox VMs\testvm\testvm.vdi"
- Verify the PersistentVolumeClaim created via the DataVolume
image upload in the previous step
kubectl describe pvc/testvm
- Create a guest virtual machine definition that references the
DataVolume containing our guest virtual machine disk image
kubectl create -f vm_testvm.yaml
3
- Expose the Jellyfin service in Kubernetes via a NodePort type
service
kubectl create -f service_jellyfin.yaml
4
- Let's verify the running guest virtual machine by using the virtctl
command to open a vnc session to the MS Window console. While we are here
let's also open a web browser and confirm web browser access to the
application.
virtctl vnc testvm
Task to performed on user workstation
-
And finally let's confirm web browser access via the Kubernetes service url.
SUCCESS
Here we have successfully demonstrated how simple it can be to migrate an existing MS Windows platform and application to Kubernetes control. For questions feel free to join the conversation via one of the project forums.
Footnotes
- Fedora virtio drivers need to be installed on Windows hosts or virtual machines that will be migrated into a Kubernetes environment. Drivers can be found here . ↩
-
Please note:
• Users without certificate authority trusted certificates added to the kubernetes api and cdi cdi-proxyuploader secret will require the--insecure
arg.
• Users without the uploadProxyURLOverride patch to the cdi cdiconfig.cdi.kubevirt.io/config crd will require the--uploadProxyURL
arg.
• Users need a correctly configured $HOME/.kube/config along with client authentication certificate. ↩ - vm_testvm.yaml : Virtual machine manifest ↩
- service_jellyfin.yaml : Service manifest ↩