VirtualMachine
Scope: Namespaced
Version: v1alpha2
This resource describes the configuration and status of a virtual machine (VM). For a running VM, parameter changes can only be applied after the VM is rebooted, except for the following parameters (they are applied on the fly):
.metadata.labels
..metadata.annotations
..spec.disruptions.restartApprovalMode
..spec.disruptions.runPolicy
.
- spec
Required value
- spec.affinity
The same as in the pods
spec.affinity
parameter in Kubernetes;The affinity setting is completely similar to the above documentation, the only difference is in the names of some parameters. In fact, the following analogs are used:
- podAffinity -> virtualMachineAndPodAffinity
- podAffinityTerm -> virtualMachineAndPodAffinityTerm
- spec.affinity.nodeAffinity
Describes node affinity scheduling rules for the VM.
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference
Required value
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference.matchExpressions
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference.matchExpressions.key
Required value
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference.matchExpressions.operator
Required value
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference.matchExpressions.values
- Element of the array
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference.matchFields
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference.matchFields.key
Required value
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference.matchFields.operator
Required value
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.preference.matchFields.values
- Element of the array
- spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution.weight
Required value
Allowed values:
1 <= X <= 100
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms
Required value
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms.matchExpressions
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms.matchExpressions.key
Required value
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms.matchExpressions.operator
Required value
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms.matchExpressions.values
- Element of the array
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms.matchFields
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms.matchFields.key
Required value
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms.matchFields.operator
Required value
- spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms.matchFields.values
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity
Describes pod and VM affinity scheduling rules.
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm
Required value
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchExpressions
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchExpressions.key
Required value
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchExpressions.operator
Required value
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchExpressions.values
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchLabels
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.matchLabelKeys
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.mismatchLabelKeys
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchExpressions
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchExpressions.key
Required value
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchExpressions.operator
Required value
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchExpressions.values
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchLabels
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaces
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.topologyKey
Required value
- spec.affinity.virtualMachineAndPodAffinity.preferredDuringSchedulingIgnoredDuringExecution.weight
Required value
Allowed values:
1 <= X <= 100
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchExpressions
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchExpressions.key
Required value
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchExpressions.operator
Required value
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchExpressions.values
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchLabels
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.matchLabelKeys
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.mismatchLabelKeys
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchExpressions
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchExpressions.key
Required value
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchExpressions.operator
Required value
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchExpressions.values
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchLabels
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaces
- Element of the array
- spec.affinity.virtualMachineAndPodAffinity.requiredDuringSchedulingIgnoredDuringExecution.topologyKey
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity
Describes pod and VM anti-affinity scheduling rules.
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchExpressions
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchExpressions.key
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchExpressions.operator
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchExpressions.values
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.labelSelector.matchLabels
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.matchLabelKeys
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.mismatchLabelKeys
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchExpressions
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchExpressions.key
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchExpressions.operator
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchExpressions.values
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaceSelector.matchLabels
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.namespaces
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.virtualMachineAndPodAffinityTerm.topologyKey
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.weight
Required value
Allowed values:
1 <= X <= 100
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchExpressions
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchExpressions.key
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchExpressions.operator
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchExpressions.values
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.labelSelector.matchLabels
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.matchLabelKeys
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.mismatchLabelKeys
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchExpressions
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchExpressions.key
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchExpressions.operator
Required value
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchExpressions.values
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaceSelector.matchLabels
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.namespaces
- Element of the array
- spec.affinity.virtualMachineAndPodAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.topologyKey
Required value
- spec.blockDeviceRefs
Required value
List of block devices that can be mounted by disks belonging to the virtual machine. The order of booting is determined by the order in the list.
The reference to block device.
- spec.blockDeviceRefs.kind
The type of the block device. Options are:
ClusterVirtualImage
— UseClusterVirtualImage
as the disk. This type is always mounted in RO mode. If the image is an iso-image, it will be mounted as a CDROM device.VirtualImage
— UseVirtualImage
as the disk. This type is always mounted in RO mode. If the image is an iso-image, it will be mounted as a CDROM device.VirtualDisk
— UseVirtualDisk
as the disk. This type is always mounted in RW mode.
Allowed values:
ClusterVirtualImage
,VirtualImage
,VirtualDisk
- spec.blockDeviceRefs.name
The name of attached resource.
- spec.bootloader
Defines bootloader for VM.
- BIOS - use legacy BIOS.
- EFI - use Unified Extensible Firmware (EFI/UEFI).
- EFIWithSecureBoot - use UEFI/EFI with SecureBoot support.
Default:
"BIOS"
Allowed values:
BIOS
,EFI
,EFIWithSecureBoot
- spec.cpu
Required value
Specifies the CPU settings for the VM.
- spec.cpu.coreFraction
Guaranteed share of CPU that will be allocated to the VM. Specified as a percentage.
Default:
"100%"
- spec.cpu.cores
Required value
Specifies the number of cores inside the VM. The value must be greater or equal 1.
Allowed values:
1 <= X
- spec.disruptions
Describing the policy for applying changes that require rebooting the VM.
Changes to some VM configuration settings require a reboot of the VM to apply them. This policy allows you to specify the behavior of how the VM will respond to such changes.
Default:
{"restartApprovalMode":"Manual"}
- spec.disruptions.restartApprovalMode
Approval mode for changes that require rebooting the VM:
Manual
- changes will not be applied until the user reboots the VM himself.Automatic
- the VM will be rebooted immediately after saving the parameters that require rebooting the VM.
Allowed values:
Manual
,Automatic
- spec.enableParavirtualization
Use the
virtio
bus to connect virtual devices of the VM. Set to false to disablevirtio
for this VM.Note: To use paravirtualization mode, some operating systems require the appropriate drivers to be installed.
Default:
true
- spec.memory
Required value
Specifies the memory settings for the VM.
- spec.memory.size
Required value
Describes the maximum amount of memory resources allowed.
Pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- spec.osType
The parameter allows you to select the type of used OS, for which a VM with an optimal set of required virtual devices and parameters will be created.
- Windows - for Microsoft Windows family operating systems.
- Generic - for other types of OS.
Default:
"Generic"
Allowed values:
Windows
,Generic
- spec.provisioning
This block allows you to configure the provisioning script for the VM.
- spec.provisioning.sysprepRef
Reference to an existing Windows sysprep automation.
Resource structure for the SysprepRef type:
.data.autounattend.xml
..data.unattend.xml
.
- spec.provisioning.sysprepRef.kind
Required value
The kind of an existing Windows sysprep automation resource. Need to use a custom secret type - “provisioning.virtualization.deckhouse.io/sysprep”
Default:
"Secret"
Allowed values:
Secret
- spec.provisioning.sysprepRef.name
Required value
Secret name.
- spec.provisioning.type
This parameter defines the type of provisioning script:
Parameters supported for using the provisioning script:
- UserData - use the cloud-init in the .spec.provisioning.UserData section.
- UserDataRef - use a cloud-init script that resides in a different resource.
- SysprepRef - Use a Windows Automation script that resides in a different resource.
More information: https://cloudinit.readthedocs.io/en/latest/reference/examples.html
Allowed values:
UserData
,UserDataRef
,SysprepRef
- spec.provisioning.userData
Inline cloud-init userdata script.
- spec.provisioning.userDataRef
A reference to an existing resource with a cloud-init script.
Resource structure for userDataRef type:
.data.userData
.
- spec.provisioning.userDataRef.kind
Required value
The kind of an existing cloud-init automation resource. Need to use a custom secret type - “provisioning.virtualization.deckhouse.io/cloud-init”
Default:
"Secret"
Allowed values:
Secret
- spec.provisioning.userDataRef.name
Required value
The name of the resource.
- spec.runPolicy
This parameter defines the VM startup policy
AlwaysOn
- after creation the VM is always in a running state, even in case of its shutdown by OS means.AlwaysOff
- after creation the VM is always in the off state.Manual
- after creation the VM is switched off, the VM state (switching on/off) is controlled via sub-resources or OS means.AlwaysOnUnlessStoppedManually
- after creation the VM is always in a running state. The VM can be shutdown by means of the OS or use the d8 utility:d8 v stop <vm_name>
.
Default:
"AlwaysOnUnlessStoppedManually"
Allowed values:
AlwaysOn
,AlwaysOff
,Manual
,AlwaysOnUnlessStoppedManually
- spec.terminationGracePeriodSeconds
Grace period observed after signalling a VM to stop after which the VM is force terminated.
Default:
60
- spec.tolerations.effect
- spec.tolerations.key
- spec.tolerations.operator
- spec.tolerations.tolerationSeconds
- spec.tolerations.value
- spec.topologySpreadConstraints
The same as in the pods
spec.topologySpreadConstraints
parameter in Kubernetes;- spec.topologySpreadConstraints.labelSelector
- spec.topologySpreadConstraints.labelSelector.matchExpressions
- spec.topologySpreadConstraints.labelSelector.matchExpressions.key
Required value
- spec.topologySpreadConstraints.labelSelector.matchExpressions.operator
Required value
- spec.topologySpreadConstraints.labelSelector.matchExpressions.values
- Element of the array
- spec.topologySpreadConstraints.labelSelector.matchLabels
- spec.topologySpreadConstraints.maxSkew
Required value
- spec.topologySpreadConstraints.topologyKey
Required value
- spec.topologySpreadConstraints.whenUnsatisfiable
Required value
- spec.virtualMachineClassName
Required value
Name of the
VirtualMachineClass
resource describing the requirements for a virtual CPU, memory and the resource allocation policy and node placement policies for virtual machines. - spec.virtualMachineIPAddressName
Name for the associated
virtualMachineIPAddress
resource.Specified when it is necessary to use a previously created IP address of the VM.
If not explicitly specified, by default a
virtualMachineIPAddress
resource is created for the VM with a name similar to the VM resource (.metadata.name
).