VM Clone
A VM clone is a copy of a virtual machine. After the cloning operation, the clone VM runs as a separate virtual machine.
The clone.kubevirt.io API Group defines resources for cloning KubeVirt VMs.
Creating a VM Clone
Under the hood, the clone API relies upon Snapshot & Restore APIs. Therefore, in order to be able to use the clone API, please see VM Snapshot & Restore pre-requisites.
In order to initiate cloning, a VirtualMachineClone
object (CRD) needs to be created on the cluster. An example for such an object is:
kind VirtualMachineClone
apiVersion"clone.kubevirt.io/v1alpha1"
metadata
name clone-fedora-1
spec
# source & target definitions
source
apiGroup kubevirt.io
kind VirtualMachine
name fedora-vm-1
target
apiGroup kubevirt.io
kind VirtualMachine
name fedora-vm-1-clone
Apply it and see the clone progress:
kubectl get vmclone -w
NAME PHASE SOURCEVIRTUALMACHINE TARGETVIRTUALMACHINE
clone-fedora-1 fedora-vm-1 fedora-vm-1-clone
clone-fedora-1 SnapshotInProgress fedora-vm-1 fedora-vm-1-clone
clone-fedora-1 RestoreInProgress fedora-vm-1 fedora-vm-1-clone
clone-fedora-1 Succeeded fedora-vm-1 fedora-vm-1-clone
Source & Target
The source and target indicate the source/target API group, kind and name. A few important notes:
- Currently, the only supported kinds are
VirtualMachine
(ofkubevirt.io
api group) andVirtualMachineSnapshot
( ofsnapshot.kubevirt.io
api group), but more types are expected to be supported in the future. See "future roadmap" below for more info. - The target name is optional. If unspecified, the clone controller will generate a name for the target automatically.
- The target and source must reside in the same namespace.
Was this page helpful?