vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.57k stars 1.39k forks source link

Unable to change disk type with velero-plugin-for-microsoft-azure #7083

Open michael1011101 opened 10 months ago

michael1011101 commented 10 months ago

What steps did you take and what happened: I tried to backup a PV in Azure disk as Premium SSD, then restore it as Premium SSD v2. It succeeded to create one PV, but not SSD v2.

What did you expect to happen: I expected to use velero backup from one disk type (Premium SSD) to another disk type( Premium SSD v2 ).

Anything else you would like to add:

Environment:

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.

ywk253100 commented 10 months ago

Did you backup the PV with file-system backup, Azure snapshot or CSI snapshot? How did you change the disk type?

michael1011101 commented 10 months ago

Did you backup the PV with file-system backup, Azure snapshot or CSI snapshot? I don't understand. The velero server was installed by others, I just use it by velero cli. How can I check it?

How did you change the disk type?

I used the method of dynamically creating PVs. I changed the disk type by adding one new storageclass with new disk type. And then use the configmap to define how the storage class can be changed.

apiVersion: v1
kind: ConfigMap
metadata:
  # any name can be used; Velero uses the labels (below)
  # to identify it rather than the name
  name: change-storage-class-config-v2
  # must be in the velero namespace
  namespace: velero
  # the below labels should be used verbatim in your
  # ConfigMap.
  labels:
    # this value-less label identifies the ConfigMap as
    # config for a plugin (i.e. the built-in restore item action plugin)
    velero.io/plugin-config: ""
    # this label identifies the name and kind of plugin
    # that this ConfigMap is for.
    velero.io/change-storage-class: RestoreItemAction
data:
  # add 1+ key-value pairs here, where the key is the old
  # storage class name and the value is the new storage
  # class name.
  source-storage-class: target-storage-class-v2
ywk253100 commented 10 months ago

Did you get any error or just the new storage class doesn't work?

michael1011101 commented 10 months ago

No error. After executing velero restore create --from-backup testbackup, the storageClassName of PVC was changed from source-storage-class to target-storage-class-v2, but the type of Azure disk didn't changed.

The storageaccounttype of sc source-storage-class is Premium_LRS, and the storageaccounttype of target-storage-class-v2 is PremiumV2_LRS.

ywk253100 commented 10 months ago

You need to use filesystem backup to backup your PVs, filesystem backup will create new PVs with the new storage class during the restore

michael1011101 commented 10 months ago

I find one method to enable the filesystem backup here

By default, velero install does not install Velero’s File System Backup. To enable it, specify the --use-node-agent flag.

Please tell me if there are other tips to pay attention to use filesystem backup.

michael1011101 commented 10 months ago

Hi @ywk253100 , in our system, the velero only enable snapshot backup, so I want to know if the snapshot will support the disk type change feature, which means backup and restore PV from disk_type_A to disk_type_B?

ywk253100 commented 10 months ago

Hi @ywk253100 , in our system, the velero only enable snapshot backup, so I want to know if the snapshot will support the disk type change feature, which means backup and restore PV from disk_type_A to disk_type_B?

No, snapshot doesn't support changing the disk type

michael1011101 commented 10 months ago

Could you share it with azure-plugin team, do they have plan to support this feature for snapshot backup? And we think it is one new feature request for them if the customer want to change the disk type when backing up and restoring disks.

michael1011101 commented 10 months ago

Create two feature requirements. For Velero, https://github.com/vmware-tanzu/velero/issues/7108 For velero-plugin-for-microsoft-azure, https://github.com/vmware-tanzu/velero/issues/7109

ywk253100 commented 10 months ago

I doubt whether this is supported by Azure: create a different type of disk from the snapshot