Anthos VM Runtime runs virtual-machine workloads on Anthos on bare metal, allowing VM-based network functions and other workloads to coexist with containerized workloads. It is based on KubeVirt. section 8.3.2
Configure the runtime and its virtual machines by:
- Enabling the VMRuntime custom resource and verifying VMRuntime.Status.Ready is true. section 8.3.2
- Selecting hardware virtualization or useEmulation when hardware support is unavailable or uncertain; hardware virtualization performs better. section 8.3.2
- Choosing raw or qcow2 images: raw may perform better but can consume more disk. section 8.3.2
- Preparing cloud-init for console access before creating a VM. section 8.3.2
Enable the runtime and create a VM
Set enabled: true in the VMRuntime resource, optionally configure useEmulation and vmImageFormat, then create a VM with kubectl virt create vm, specifying its image, CPU, memory, boot disk, storage class, and cloud-init file. section 8.3.2
apiVersion: vm.cluster.gke.io/v1 kind: VMRuntime metadata: name: vmruntime Spec: enabled: true # useEmulation default to false if not set. useEmulation: true # vmImageFormat default to "qcow2" if not set. vmImageFormat: qcow2
Shows the VMRuntime custom resource with enablement, emulation, and image-format settings. section 8.3.2
kubectl virt create vm VM_NAME \ --boot-disk-access-mode=MODE \ --boot-disk-size=DISK_SIZE \ --boot-disk-storage-class="DISK_CLASS" \ --cloud-init-file=FILE_PATH \ --cpu=CPU_NUMBER \ --image=IMAGE_NAME \ --memory=MEMORY_SIZE
Shows the kubectl virt create vm command and its VM resource options. section 8.3.2
