Running Windows Server With Kubevirt

April 15, 2023

Running Windows Server With Kubevirt

In this post i will show you how to run your windows server workloads and needs in KubeVirt. Also probably what usecase when you need this.


I work for a company that has workloads running on Windows Servers, and the cost of using public cloud windows is quite high. To address this challenge, I proposed a solution to host the Windows servers on bare metal as service servers (already bootstrapped with Kubespray). This approach not only provides better latency since the servers are in our country (Indonesia), but it also significantly reduces costs.


1. Virualization Enabled

Make sure your kubernetes nodes already enable Virtualization

2. Presistent Backend Storage

You need storageclass kubernetes with presistent backend storage like CEPH, Longhorn, vSAN or whatever.

3. Understand What Kubevirt Do

If you has't understand what kubevirt do, is basicly do what kvm and qemu automation with YAML kubernetes. Go checkout

4. Installed the KubeVirt and Container Data Importer Engine

Follow the guide from official docs, or here my previouse introduction about kubevirt

5. Virt Plugin Kubectl

We need this plugin to make our life easier, install it with

Let's Deploy Your Windows

In this blog i will use image, bacause the image is already cloudinit-able or some people may say "Cloud Native"

1. Download the Image

Download the image where ever you can access your your cluster with kubectl

2. Forward Your CDI Upload Proxy

kubectl port-forward svc/cdi-uploadproxy -n cdi 6969:443

3. Upload With Virt Plugin

kubectl virt image-upload \
--image-path=./windows_server_2012_kvm.qcow2 \
--pvc-name=iso-winserver-r12 \
--access-mode=ReadWriteOnce \
--pvc-size=20G \
--storage-class=kind-local \
--uploadproxy-url=https://localhost:6969 \

4. Specifiying Your VM

kind: VirtualMachine
  creationTimestamp: 2023-04-10T15:03:08Z
  generation: 1
  labels: windows
  name: windowsvm1
  running: true
      creationTimestamp: null
      labels: windowsvm1
          cores: 4
          - disk:
              bus: virtio
            name: disk0
          - cdrom:
              bus: sata
              readonly: true
            name: cloudinitdisk
          type: q35
            memory: 4096M
      - name: disk0
          claimName: iso-winserver-r12
      - cloudInitConfigDrive:
          userData: |
            net user Administrator THizisMypzzzowrd
        name: cloudinitdisk

5. Verify VM Running State

Verify VM Running State

Profile picture

Written by Nicolas Julian Seseorang yang mencoba berkarya. Chit Chat with me in Twitter