|
| 1 | +# Volume Cloning Example |
| 2 | +## Feature Status: Beta |
| 3 | + |
| 4 | +- supported from v1.23.2 |
| 5 | + |
| 6 | +## Create a Source PVC |
| 7 | + |
| 8 | +```console |
| 9 | +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/storageclass-blobfuse2.yaml |
| 10 | +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/pvc-blob-csi.yaml |
| 11 | +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/nginx-pod-blob.yaml |
| 12 | +``` |
| 13 | + |
| 14 | +### Check the Source PVC |
| 15 | + |
| 16 | +```console |
| 17 | +$ kubectl exec nginx-blob -- ls /mnt/blob |
| 18 | +outfile |
| 19 | +``` |
| 20 | + |
| 21 | +## Create a PVC from an existing PVC |
| 22 | +> Make sure application is not writing data to source blob container |
| 23 | +```console |
| 24 | +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/cloning/pvc-blob-cloning.yaml |
| 25 | +``` |
| 26 | +### Check the Creation Status |
| 27 | + |
| 28 | +```console |
| 29 | +$ kubectl describe pvc pvc-blob-cloning |
| 30 | +Name: pvc-blob-cloning |
| 31 | +Namespace: default |
| 32 | +StorageClass: blob-fuse |
| 33 | +Status: Bound |
| 34 | +Volume: pvc-6db5af93-3b32-4c24-a68e-b727d7801fd5 |
| 35 | +Labels: <none> |
| 36 | +Annotations: kubectl.kubernetes.io/last-applied-configuration: |
| 37 | + {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"pvc-blob-cloning","namespace":"default"},"spec":{"a... |
| 38 | + pv.kubernetes.io/bind-completed: yes |
| 39 | + pv.kubernetes.io/bound-by-controller: yes |
| 40 | + volume.beta.kubernetes.io/storage-provisioner: blob.csi.azure.com |
| 41 | + volume.kubernetes.io/storage-provisioner: blob.csi.azure.com |
| 42 | +Finalizers: [kubernetes.io/pvc-protection] |
| 43 | +Capacity: 100Gi |
| 44 | +Access Modes: RWX |
| 45 | +VolumeMode: Filesystem |
| 46 | +Mounted By: <none> |
| 47 | +Events: |
| 48 | + Type Reason Age From Message |
| 49 | + ---- ------ ---- ---- ------- |
| 50 | + Normal Provisioning 16s blob.csi.azure.com_aks-nodepool1-34988195-vmss000002_8ecdf8ad-b636-4ca5-81ee-0f1a49337168 External provisioner is provisioning volume for claim "default/pvc-blob-cloning" |
| 51 | + Normal ExternalProvisioning 14s (x3 over 16s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "blob.csi.azure.com" or manually created by system administrator |
| 52 | + Normal ProvisioningSucceeded 8s blob.csi.azure.com_aks-nodepool1-34988195-vmss000002_8ecdf8ad-b636-4ca5-81ee-0f1a49337168 Successfully provisioned volume pvc-6db5af93-3b32-4c24-a68e-b727d7801fd5 |
| 53 | +``` |
| 54 | + |
| 55 | +## Restore the PVC into a Pod |
| 56 | + |
| 57 | +```console |
| 58 | +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/cloning/nginx-pod-restored-cloning.yaml |
| 59 | +``` |
| 60 | + |
| 61 | +### Check Sample Data |
| 62 | + |
| 63 | +```console |
| 64 | +$ kubectl exec nginx-blob-restored-cloning -- ls /mnt/blob |
| 65 | +outfile |
| 66 | +``` |
0 commit comments