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

  1. Before we begin let's take a moment to ensure the service is running and web browser accessible
    Ensure application service is running

    Confirm web browser access


  2. Power down the guest virtual machine to ensure all changes to the filesystem are quiesced to disk.
    VBoxManage.exe controlvm testvm poweroff
    Power down the guest virtual machine


  3. 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"
    Upload disk image


  4. Verify the PersistentVolumeClaim created via the DataVolume image upload in the previous step
    kubectl describe pvc/testvm
    Verify PersistentVolumeClaim


  5. Create a guest virtual machine definition that references the DataVolume containing our guest virtual machine disk image
    kubectl create -f vm_testvm.yaml 3
    Create the guest virtual machine


  6. Expose the Jellyfin service in Kubernetes via a NodePort type service
    kubectl create -f service_jellyfin.yaml 4
    Create NodePort service


  7. 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
    Verify running guest virtual machine

    Web browser access to application


Task to performed on user workstation

    And finally let's confirm web browser access via the Kubernetes service url.
    Web browser access to Kubernetes service


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

  1. 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 .
  2. 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.
  3. vm_testvm.yaml : Virtual machine manifest
  4. service_jellyfin.yaml : Service manifest