Deploy a VM
This page reviews the different components, workflows, and decisions related to deploying a VM with VM Operator:
The VirtualMachine API
apiVersion: vmoperator.vmware.com/v1alpha5 # (1)
kind: VirtualMachine # (2)
metadata:
name: my-vm # (3)
namespace: my-namespace # (4)
spec:
className: my-vm-class # (5)
imageName: vmi-0a0044d7c690bcbea # (6)
storageClass: my-storage-class # (7)
bootstrap: # (8)
cloudInit:
cloudConfig: {}
hardware:
cdrom: # (9)
- name: cdrom1
image:
name: vmi-0a0044d7c690bcbea
kind: VirtualMachineImage
connected: true
allowGuestControl: true
-
The field
apiVersionindicates the resource's schema, ex.vmoperator.vmware.com, and version, ex.v1alpha5. -
The field
kindspecifies the kind of resource, ex.VirtualMachine. -
The field
metadata.nameis used to uniquely identify an instance of an API resource in a given Kubernetes namespace. -
The field
metadata.namespacedenotes in which Kubernetes namespace the API resource is located. -
The field
spec.classNamerefers to the name of theVirtualMachineClassresource that provides the hardware configuration when deploying a VM.The
VirtualMachineClassAPI is cluster-scoped, and the following command may be used to print all of the VM classes on a cluster:kubectl get vmclassHowever, access to these resources is per-namespace. To determine the names of the VM classes that may be used in a given namespace, use the following command:
kubectl get -n <NAMESPACE> vmclassbinding -
The field
spec.imageNamerefers to the name of theClusterVirtualMachineImageorVirtualMachineImageresource that provides the disk(s) when deploying a VM.- If there is a
ClusterVirtualMachineImageresource with the specified name, the cluster-scoped resource is used, otherwise... - If there is a
VirtualMachineImageresource in the same namespace as the VM being deployed, the namespace-scoped resource is used.
The following command may be used to print a list of the images available to the entire cluster:
kubectl get clustervmimageWhereas this command may be used to print a list of images available to a given namespace:
kubectl get -n <NAMESPACE> vmimage - If there is a
-
The field
spec.storageClassrefers to the Kubernetes storage class used to configure the storage for the VM.The following command may be used to print a list of the storage classes available to the entire cluster:
kubectl get storageclass -
The field
spec.bootstrap, and the fields inside of it, are used to configure the VM's bootstrap provider. -
The field
spec.hardware.cdromis used to configure the VM's CD-ROM devices to mount ISO images.
Bootstrap Provider
There are a number of methods that may be used to bootstrap a virtual machine's (VM) guest operating system:
| Provider | Network Config | Linux | Windows | Description |
|---|---|---|---|---|
| Cloud-Init | Cloud-Init Network v2 | ✓ | ✓ | The industry standard, multi-distro method for cross-platform, cloud instance initialization with modern, VM images |
| Sysprep | Guest OS Customization (GOSC) | ✓ | Microsoft Sysprep is used by VMware to customize Windows images on first-boot | |
| vAppConfig | Bespoke | ✓ | For images with bespoke, bootstrap engines driven by vAppConfig properties |
Please refer to the documentation for bootstrap providers for more information.