CSI volume cloning
A Container Storage Interface (CSI) volume clone is a duplicate of an existing persistent volume at a particular point in time.
Volume cloning is similar to volume snapshots, although it is more efficient. For example, a cluster administrator can duplicate a cluster volume by creating another instance of the existing cluster volume.
Cloning creates an exact duplicate of the specified volume on the back-end device, rather than creating a new empty volume. After dynamic provisioning, you can use a volume clone just as you would use any standard volume.
No new API objects are required for cloning. The existing field in the PersistentVolumeClaim
object is expanded so that it can accept the name of an existing PersistentVolumeClaim in the same namespace.
By default, OKD supports CSI volume cloning with these limitations:
The destination persistent volume claim (PVC) must exist in the same namespace as the source PVC.
Support is only available for CSI drivers. In-tree and FlexVolumes are not supported.
CSI drivers might not have implemented the volume cloning functionality. For details, see the CSI driver documentation.
OKD 4.8 supports version 1.1.0 of the CSI specification.
Provisioning a CSI volume clone
When you create a cloned persistent volume claim (PVC) API object, you trigger the provisioning of a CSI volume clone. The clone pre-populates with the contents of another PVC, adhering to the same rules as any other persistent volume. The one exception is that you must add a dataSource
that references an existing PVC in the same namespace.
Prerequisites
Your PVC is created using a CSI driver that supports volume cloning.
Your storage back end is configured for dynamic provisioning. Cloning support is not available for static provisioners.
Procedure
Create and save a file with the object described by the following YAML:
pvc-clone.yaml
Create the object you saved in the previous step by running the following command:
A new PVC
pvc-1-clone
is created.Create and save a file with the
Pod
object described by the YAML. For example:1 The cloned PVC created during the CSI volume cloning operation.