|
1 | 1 | = Harvester CSI Driver |
2 | | -:revdate: 2026-06-03 |
| 2 | +:revdate: 2026-06-09 |
3 | 3 | :page-revdate: {revdate} |
4 | 4 |
|
5 | 5 | The Harvester Container Storage Interface (CSI) driver provides a standard CSI interface used by guest Kubernetes clusters. It connects to the {harvester-product-name} cluster and hot-plugs volumes to the virtual machines to provide native storage performance. |
@@ -510,6 +510,170 @@ Starting with *v0.1.25*, the Harvester CSI Driver supports https://kubernetes.io |
510 | 510 | * Harvester CSI Driver v0.1.25 or later |
511 | 511 | * The CSI snapshot controller and the required manifests are properly deployed on the guest cluster. These components are deployed by default on RKE2. |
512 | 512 |
|
| 513 | +== Volume backups |
| 514 | + |
| 515 | +Starting with **v0.1.28**, the Harvester CSI Driver supports remote volume backup and restore for guest Kubernetes clusters. This feature allows you to back up a PersistentVolumeClaim (PVC) to the {harvester-product-name} backup target, and subsequently restore it to either the source guest cluster or a different guest cluster running on the same {harvester-product-name} cluster. |
| 516 | + |
| 517 | +=== Prerequisites |
| 518 | + |
| 519 | +* {harvester-product-name} v1.8 or later |
| 520 | +* Harvester CSI Driver v0.1.28 or later |
| 521 | +* The CSI snapshot controller, along with its required CRDs and deployment manifests, is properly deployed on the guest cluster. |
| 522 | +* A backup target is configured and ready on the {harvester-product-name} cluster. |
| 523 | + |
| 524 | +To verify the status of the CSI snapshot controller and the required CRDs, run the following commands on RKE2: |
| 525 | + |
| 526 | +[,shell] |
| 527 | +---- |
| 528 | +$ kubectl -n kube-system get po -lapp.kubernetes.io/name=rke2-snapshot-controller |
| 529 | +NAME READY STATUS RESTARTS AGE |
| 530 | +rke2-snapshot-controller-858d65d54-nvlfq 1/1 Running 0 5d17h |
| 531 | +
|
| 532 | +$ kubectl get crd --show-labels | grep -i volumesnapshot |
| 533 | +volumesnapshotclasses.snapshot.storage.k8s.io 2026-04-16T23:26:24Z app.kubernetes.io/managed-by=Helm |
| 534 | +volumesnapshotcontents.snapshot.storage.k8s.io 2026-04-16T23:26:24Z app.kubernetes.io/managed-by=Helm |
| 535 | +volumesnapshots.snapshot.storage.k8s.io 2026-04-16T23:26:24Z app.kubernetes.io/managed-by=Helm |
| 536 | +---- |
| 537 | + |
| 538 | +=== Creating a volume backup |
| 539 | + |
| 540 | +. Create a `VolumeSnapshotClass` for backups on the guest cluster. |
| 541 | ++ |
| 542 | +[,yaml] |
| 543 | +---- |
| 544 | + apiVersion: snapshot.storage.k8s.io/v1 |
| 545 | + deletionPolicy: Delete |
| 546 | + driver: driver.harvesterhci.io |
| 547 | + kind: VolumeSnapshotClass |
| 548 | + metadata: |
| 549 | + name: harvester-backup |
| 550 | + parameters: |
| 551 | + type: backup |
| 552 | +---- |
| 553 | + |
| 554 | +. Create a `VolumeSnapshot` for the source PVC. |
| 555 | ++ |
| 556 | +[,yaml] |
| 557 | +---- |
| 558 | + apiVersion: snapshot.storage.k8s.io/v1 |
| 559 | + kind: VolumeSnapshot |
| 560 | + metadata: |
| 561 | + name: snapshot-fs-vol |
| 562 | + namespace: default |
| 563 | + spec: |
| 564 | + volumeSnapshotClassName: harvester-backup |
| 565 | + source: |
| 566 | + persistentVolumeClaimName: fs-vol |
| 567 | +---- |
| 568 | + |
| 569 | +. Wait until the `VolumeSnapshot` becomes ready to use. |
| 570 | ++ |
| 571 | +[,shell] |
| 572 | +---- |
| 573 | +kubectl get volumesnapshot snapshot-fs-vol -n default |
| 574 | +---- |
| 575 | ++ |
| 576 | +Once the `VolumeSnapshot` is ready, a corresponding `VolumeRemoteBackup` resource is automatically generated on the underlying {harvester-product-name} cluster for restore operations. |
| 577 | + |
| 578 | +. On the {harvester-product-name} cluster, retrieve a list of the generated `VolumeRemoteBackup` resources. |
| 579 | ++ |
| 580 | +[,shell] |
| 581 | +---- |
| 582 | +kubectl get volumeremotebackups -A |
| 583 | +---- |
| 584 | + |
| 585 | +=== Restoring a backup on the same guest cluster |
| 586 | + |
| 587 | +. Create a new PVC and set its `spec.dataSource` to the backup `VolumeSnapshot`. |
| 588 | ++ |
| 589 | +[,yaml] |
| 590 | +---- |
| 591 | +apiVersion: v1 |
| 592 | +kind: PersistentVolumeClaim |
| 593 | +metadata: |
| 594 | + name: restore-fs-vol |
| 595 | + namespace: default |
| 596 | +spec: |
| 597 | + accessModes: |
| 598 | + - ReadWriteOnce |
| 599 | + resources: |
| 600 | + requests: |
| 601 | + storage: 2Gi |
| 602 | + storageClassName: harvester |
| 603 | + dataSource: |
| 604 | + apiGroup: snapshot.storage.k8s.io |
| 605 | + kind: VolumeSnapshot |
| 606 | + name: snapshot-fs-vol |
| 607 | + volumeMode: Filesystem |
| 608 | +---- |
| 609 | + |
| 610 | +. Once the PVC is bound, mount it to a pod and verify that the restored data is intact. |
| 611 | + |
| 612 | +=== Restoring a backup on a different guest cluster |
| 613 | + |
| 614 | +You can restore a backup on a different guest cluster _running on the same {harvester-product-name} cluster_. |
| 615 | + |
| 616 | +. On the source guest cluster, <<Creating a volume backup, create a backup>>. |
| 617 | + |
| 618 | +. On the target guest cluster, create a `VolumeSnapshotContent` that points to the {harvester-product-name} backup handle in the format `backup:<VolumeRemoteBackup namespace>/<VolumeRemoteBackup name>`. |
| 619 | ++ |
| 620 | +[,yaml] |
| 621 | +---- |
| 622 | + apiVersion: snapshot.storage.k8s.io/v1 |
| 623 | + kind: VolumeSnapshotContent |
| 624 | + metadata: |
| 625 | + name: backup-fs-vol-vsc |
| 626 | + spec: |
| 627 | + deletionPolicy: Delete |
| 628 | + driver: driver.harvesterhci.io |
| 629 | + source: |
| 630 | + snapshotHandle: backup:<VolumeRemoteBackup namespace>/<VolumeRemoteBackup name> |
| 631 | + volumeSnapshotClassName: harvester-backup |
| 632 | + volumeSnapshotRef: |
| 633 | + name: backup-fs-vol |
| 634 | + namespace: default |
| 635 | +---- |
| 636 | + |
| 637 | +. Create a `VolumeSnapshot` from the `VolumeSnapshotContent`. |
| 638 | ++ |
| 639 | +[,yaml] |
| 640 | +---- |
| 641 | + apiVersion: snapshot.storage.k8s.io/v1 |
| 642 | + kind: VolumeSnapshot |
| 643 | + metadata: |
| 644 | + name: backup-fs-vol |
| 645 | + namespace: default |
| 646 | + spec: |
| 647 | + volumeSnapshotClassName: harvester-backup |
| 648 | + source: |
| 649 | + volumeSnapshotContentName: backup-fs-vol-vsc |
| 650 | +---- |
| 651 | + |
| 652 | +. Create a restore PVC from the `VolumeSnapshot`. |
| 653 | ++ |
| 654 | +[,yaml] |
| 655 | +---- |
| 656 | + apiVersion: v1 |
| 657 | + kind: PersistentVolumeClaim |
| 658 | + metadata: |
| 659 | + name: restore-fs-vol |
| 660 | + namespace: default |
| 661 | + spec: |
| 662 | + accessModes: |
| 663 | + - ReadWriteOnce |
| 664 | + resources: |
| 665 | + requests: |
| 666 | + storage: 2Gi |
| 667 | + storageClassName: harvester |
| 668 | + dataSource: |
| 669 | + apiGroup: snapshot.storage.k8s.io |
| 670 | + kind: VolumeSnapshot |
| 671 | + name: backup-fs-vol |
| 672 | + volumeMode: Filesystem |
| 673 | +---- |
| 674 | + |
| 675 | +. Once the PVC is bound, attach it to a workload on the target guest cluster and verify that the data was restored successfully. |
| 676 | + |
513 | 677 | == Upgrade the CSI Driver |
514 | 678 |
|
515 | 679 | [NOTE] |
|
0 commit comments