You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the PVC supports snapshot, you can use snapshot to backup pvc to speed up backup. You need to modify the volume policy configmap to specify that the storage class uses snapshot for backup. For example, if the `ceph` storage class supports snapshot backup, you need to add the following configuration (the added condition should be placed at the top to get higher priority):
241
+
242
+
[How to determine if the PVC supports snapshot?](./04_backup_and_restore_using_velero.mdx#how_to_determine_if_the_pvc_supports_snapshot)
243
+
244
+
:::warning
245
+
246
+
**If you use pvc snapshot backup, you cannot change the storage class when restoring. Please adjust the storage class according to the actual situation.**
247
+
248
+
:::
249
+
250
+
```diff
251
+
apiVersion: v1
252
+
kind: ConfigMap
253
+
metadata:
254
+
name: ${BACKUP_POLICY_NAME}-volume-policy
255
+
namespace: cpaas-system
256
+
data:
257
+
resourcepolicies: |
258
+
version: v1
259
+
volumePolicies:
260
+
+ - conditions:
261
+
+ storageClass:
262
+
+ - ceph
263
+
+ action:
264
+
+ type: snapshot
265
+
- conditions:
266
+
csi: {}
267
+
action:
268
+
type: fs-backup
269
+
- conditions:
270
+
csi: {}
271
+
action:
272
+
type: fs-backup
273
+
```
274
+
275
+
:::warning
276
+
277
+
If the velero is not enabled CSI snapshot, you will get the following error when backup:
278
+
279
+
```
280
+
Skip action velero.io/csi-pvc-backupper for resource persistentvolumeclaims:xxx, because the CSI feature is not enabled.
281
+
```
282
+
283
+
To fix this, you need to add `--features=EnableCSI` parameter to the velero deployment.
284
+
285
+
```diff
286
+
apiVersion: apps/v1
287
+
kind: Deployment
288
+
metadata:
289
+
name: velero
290
+
spec:
291
+
template:
292
+
spec:
293
+
containers:
294
+
- args:
295
+
- server
296
+
- --uploader-type=restic
297
+
+ - --features=EnableCSI
298
+
- --namespace=cpaas-system
299
+
command:
300
+
- /velero
301
+
name: velero
302
+
```
303
+
304
+
:::
305
+
208
306
#### Execute Backup
209
307
210
308
Run the following commands to create a backup schedule and trigger a backup job:
@@ -228,6 +326,9 @@ spec:
228
326
- ${HARBOR_NAMESPACE}
229
327
includedResources:
230
328
- '*'
329
+
resourcePolicy:
330
+
kind: configmap
331
+
name: ${BACKUP_POLICY_NAME}-volume-policy
231
332
storageLocation: ${VELERO_BACKUP_REPO_NAME}
232
333
ttl: 720h0m0s
233
334
EOF
@@ -249,6 +350,9 @@ spec:
249
350
includedResources:
250
351
- "*"
251
352
itemOperationTimeout: 4h0m0s
353
+
resourcePolicy:
354
+
kind: configmap
355
+
name: ${BACKUP_POLICY_NAME}-volume-policy
252
356
snapshotMoveData: false
253
357
storageLocation: ${VELERO_BACKUP_REPO_NAME}
254
358
ttl: 720h0m0s
@@ -462,6 +566,8 @@ spec:
462
566
- secrets
463
567
- pods
464
568
- harbors.operator.alaudadevops.io
569
+
- volumesnapshots
570
+
- volumesnapshotcontents
465
571
itemOperationTimeout: 10h0m0s
466
572
namespaceMapping:
467
573
${HARBOR_NAMESPACE}: ${NEW_HARBOR_NAMESPACE}
@@ -551,3 +657,47 @@ After the instance status returns to normal, log in to HARBOR to check whether t
551
657
552
658
At the same time, disable the read-only mode for the restored Harbor instance (log in to Harbor and uncheck Administration -> Configuration -> System Settings -> Repository Read Only).
553
659
660
+
## Q & A
661
+
662
+
### How to determine if the PVC supports snapshot? \{#how_to_determine_if_the_pvc_supports_snapshot}
663
+
664
+
To determine whether a PVC supports snapshot, you need to check if its underlying StorageClass supports snapshot functionality. A PVC supports snapshot if there is a VolumeSnapshotClass in the cluster whose `driver` matches the StorageClass's `provisioner`. If such a VolumeSnapshotClass exists, the StorageClass (and therefore the PVC) supports snapshot functionality.
0 commit comments