Skip to content

Latest commit

 

History

History
70 lines (62 loc) · 2.93 KB

File metadata and controls

70 lines (62 loc) · 2.93 KB

Azure File Snapshot feature

From v1.30.2, the restoration of an SMB file share snapshot is now supported by CSI driver.

Install CSI Driver

Follow the instructions to install snapshot driver.

1. Create source PVC and an example pod to write data

kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/storageclass-azurefile-csi.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/pvc-azurefile-csi.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/nginx-pod-azurefile.yaml
  • Check source PVC
$ kubectl exec nginx-azurefile -- ls /mnt/azurefile
outfile

2. Create a snapshot on source PVC

kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/snapshot/volumesnapshotclass-azurefile.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/snapshot/volumesnapshot-azurefile.yaml
  • Check snapshot Status
$ kubectl describe volumesnapshot azurefile-volume-snapshot
Name:         azurefile-volume-snapshot
Namespace:    default
Labels:       <none>
Annotations:  API Version:  snapshot.storage.k8s.io/v1
Kind:         VolumeSnapshot
Metadata:
  Creation Timestamp:  2020-07-21T08:00:50Z
  Finalizers:
    snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection
    snapshot.storage.kubernetes.io/volumesnapshot-bound-protection
  Generation:        1
  Resource Version:  16078
  Self Link:         /apis/snapshot.storage.k8s.io/v1/namespaces/default/volumesnapshots/azurefile-volume-snapshot
  UID:               d7a3a5fb-cf58-4e57-b561-f6d7a0d10d6d
Spec:
  Source:
    Persistent Volume Claim Name:  pvc-azurefile
  Volume Snapshot Class Name:      csi-azurefile-vsc
Status:
  Bound Volume Snapshot Content Name:  snapcontent-d7a3a5fb-cf58-4e57-b561-f6d7a0d10d6d
  Creation Time:                       2020-07-21T07:36:02Z
  Ready To Use:                        true
  Restore Size:                        100Gi
Events:                                <none>

In above example, snapcontent-2b0ef334-4112-4c86-8360-079c625d5562 is the snapshot name

3. Create a new PVC based on snapshot

kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/snapshot/pvc-azurefile-snapshot-restored.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/snapshot/nginx-pod-restored-snapshot.yaml
  • Check data
$ kubectl exec nginx-restored -- ls /mnt/azurefile
lost+found
outfile

Links