Search code examples
azureazure-akspersistent-volumesazure-fileskubernetes-pvc

Backup and Restore of a pvc created using AzureFile


I used AzureFileShare to create a dynamic PVC for a pod where I deployed a NodeJS application.

Below is the yaml of the storageclass I used to create the pvc,

apiVersion: storage.k8s.io/v1
metadata:
  name: my-azurefile
provisioner: kubernetes.io/azure-file
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=0
  - gid=0
  - mfsymlinks
  - cache=strict
  - actimeo=30
parameters:
  skuName: Standard_LRS

The yaml file I used to create the pvc,

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: dynamic-pvc
  namespace: test
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: my-azurefile

I took the backup of the namespace where the pod is deployed using velero. When I restored the backup in a different cluster, I see no data present in the pod. But when I use dynamic azuredisk pvc, I am able to restore the pod with the data.

NOTE: Before restoring the velero backup, I have created the my-azurefile storageclass in the new cluster where I performed the restoration.

Can anyone please explain why the restoration is not happening properly with the data when I use dynamic azurefile pvc? Thanks in Advance!


Solution

  • kubectl patch storageclass/<YOUR_AZURE_FILE_STORAGE_CLASS_NAME>
    --type json
    --patch '[{"op":"add","path":"/mountOptions/-","value":"nouser_xattr"}]'

    As per the above patch method, I am able to restore the data from azurefile pv.