This document shows you how to create a Windows virtual machine (VM) that boots from an ISO using VM Runtime on GDC. When the VM boots, you manually complete the Windows setup routine.
You can also create a Windows VM from a prepared disk image using an HTTP source or from Cloud Storage.
Before you begin
To complete this document, you need access to the following resources:
- Access to Google Distributed Cloud version 1.12.0 (
anthosBareMetalVersion: 1.12.0) or higher cluster. You can use any cluster type capable of running workloads. If needed, try Google Distributed Cloud on Compute Engine or see the cluster creation overview. - The
virtctlclient tool installed as a plugin forkubectl. If needed, install the virtctl client tool.
Create a virtual disk for the ISO image
To successfully create a Windows VM, follow the steps and sections in this document in order.
To boot from a Windows ISO image, first create a VirtualMachineDisk with
diskType of cdrom. Use your Windows ISO as the source for this disk.
Create a
VirtualMachineDiskmanifest, such aswindows-iso.yaml, in the editor of your choice:nano windows-iso.yamlCopy and paste the following YAML manifest:
apiVersion: vm.cluster.gke.io/v1 kind: VirtualMachineDisk metadata: name: windows-iso spec: source: http: url: IMG_URL size: 10Gi diskType: cdromReplace
IMG_URLwith the HTTP path to your Windows ISO. You can also create and use credentials to import an ISO from Cloud Storage.Save and close the manifest in your editor.
Create the
VirtualMachineDiskusingkubectl:kubectl apply -f windows-iso.yaml
Create a VM drivers disk
To successfully boot from a Windows ISO and complete the install process, the
VM needs access to the
virtio drivers. To provide the virtio drivers to the VM,
complete the following steps:
Create a
VirtualMachineDiskmanifest, such asvirtio-driver.yaml, in the editor of your choice:nano virtio-driver.yamlCopy and paste the following YAML manifest:
apiVersion: vm.cluster.gke.io/v1 kind: VirtualMachineDisk metadata: name: virtio-driver spec: size: 1Gi source: registry: url: docker://quay.io/kubevirt/virtio-container-disk:latest diskType: cdromThis manifest pulls the latest
virtiodrivers from a public Docker repo and sets thediskTypeascdrom. Your VM uses this disk during the install process.Save and close the manifest in your editor.
Create the
VirtualMachineDiskusingkubectl:kubectl apply -f virtio-driver.yaml
Create a Windows VM
Create a VM that boots from the Windows ISO VirtualMachineDisk, and attaches
the virtio drivers disk:
Create a manifest that defines a
VirtualMachineDiskfor the boot volume and aVirtualMachine, such aswindows-vm.yaml, in the editor of your choice:nano windows-vm.yamlCopy and paste the following YAML manifest:
apiVersion: vm.cluster.gke.io/v1 kind: VirtualMachineDisk metadata: name: VM_NAME-boot-dv spec: size: 100Gi --- apiVersion: vm.cluster.gke.io/v1 kind: VirtualMachine metadata: name: VM_NAME spec: osType: Windows disks: - virtualMachineDiskName: VM_NAME-boot-dv boot: true - virtualMachineDiskName: windows-iso - virtualMachineDiskName: virtio-driver compute: cpu: vcpus: 2 memory: capacity: 4Gi interfaces: - name: eth0 networkName: pod-networkReplace
VM_NAMEwith the name that you want for your VM.This manifest creates a 100 Gibibyte (GiB) boot volume. As this boot volume is empty when the VM first starts, the VM boots from ISO as a CD-ROM device to start the setup routine. The
virtiodrivers are also attached to complete the install process.Save and close the manifest in your editor.
Create the
VirtualMachineDiskandVirtualMachineusingkubectl:kubectl apply -f windows-vm.yaml
Connect to Windows VM and complete OS install
The VM starts and boots from the Windows ISO in the previous section. Connect to your VM and complete the Windows install process and configure your VM:
Connect to your Windows VM:
kubectl virt vnc VM_NAMEReplace
VM_NAMEwith the name of your Windows VM.When prompted, enter your Windows guest OS user credentials for your VM.
For more information about using
kubectl virt vncto connect to your VM, see Connect directly using VNC.In the Windows setup, choose to perform a Custom install.
Select Load driver, browse to the viostor directory on the
virtiodisk, then select the directory that matches the version of Windows you want to install.For more information, see KubeVirt Windows
virtiodrivers.With the storage and network drivers from
virtionow available, complete the rest of the Windows install process.We recommend that you enable Remote Desktop Protocol so you can connect directly to the VM after install.
Detach the ISO image and drivers disk
After the Windows install is complete, remove the virtio drivers disk and
Windows ISO image from the VM:
Stop your Windows VM:
kubectl virt stop VM_NAMEReplace
VM_NAMEwith the name of your Windows VM.Use
kubectlto edit the VM:kubectl edit gvm VM_NAMEReplace
VM_NAMEwith the name of your Windows VM.In your editor, update the
spec.diskssection to remove the Windows ISO andvirtiodisks, as shown in the following example. The only disk left attached to the VM should be theVM_NAME-boot-dv:apiVersion: vm.cluster.gke.io/v1 kind: VirtualMachine metadata: name: windows-vm spec: osType: Windows disks: - virtualMachineDiskName: windows-vm-boot-dv boot: true interfaces: ...Save and close the VM manifest.
Start your Windows VM:
kubectl virt start VM_NAMEReplace
VM_NAMEwith the name of your Windows VM.Check the
STATUSof your VM:kubectl get gvm VM_NAMEReplace
VM_NAMEwith the name of your Windows VM.Make sure that your VM is in a
Runningstate. If the VM isn't in aRunningstate, check yourVirtualMachineresource manifest to make sure you only removed the Windows ISO andvirtiodisk. Check that the host has enough compute resources to start your VM.