Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create PVC Backups via CSI Snapshots or CSI Cloned Volumes #918

Open
l0wl3vel opened this issue Dec 14, 2023 · 0 comments
Open

Create PVC Backups via CSI Snapshots or CSI Cloned Volumes #918

l0wl3vel opened this issue Dec 14, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@l0wl3vel
Copy link
Contributor

Summary

As "a K8up User"
I want "to back up PVCs via an intermediate snapshot or cloned volume"
So that "I gain atomicity and performance from snapshotting and the portability of Restic backups"

Context

Instead of directly mounting volumes for backup we could introduce an annotation to instruct K8up to create a snapshot of a PVC, instantiate a PVC from that snapshot, and run the Backup from that volume. This affect the following aspects of a backup, depending on the internal workings of the used CSI Driver:

Consistency

If a Volume is slow compared to its size a backup can take a long time, which can introduce consistency issues in the data. Some Backends/CSI Drivers/VolumeSnapshotClasses guarantee crash consistency, which would also transfer to the K8up Backups while using them.

Performance

The performance characteristics of volumes is defined per volume on most public clouds. By backing up from a snapshot, all provisioned bandwidth can go into running the backup, while the application is not affected.

Open Questions

Snapshot+Restore vs. Cloning

Both mechanisms are related to each other but some CSI Driver that implement one, don`t implement the other (Source). Direct volume cloning would make the K8up code simpler, but would reduce compatibility.

I am only speculating here, since I have not read CSI driver code for Drivers that implement both, but there might be different implementations for Snapshots and Cloning that affect consistency and speed.

Personally I think, that it is necessary to implement both a Snapshot+Restore and a Cloning code path

Out of Scope

  • Replacing how backups are done without CSI involvement
  • Non-CSI Vendor specific implementations of snapshotting

Further links

Acceptance Criteria

No response

Implementation Ideas

I think this is possible to implement without breaking the existing K8up API.

"Backup Mode Annotation"

My intuitive idea would be this Annotation on the PVC:

k8up.io/via-csi: "snapshot" or "clone" or omitted for backup without CSI involvement
k8up.io/csi-volume-snapshot-class: "custom-volume-snapshot-class"

You probably do not want to make this flag available on Pods, since they can mount PVCs from multiple different CSI drivers. It might be also a reasonable idea to make this annotation work on StorageClasses.

Removing Snapshots and intermediate volumes after completing/canceling a Backup

It necessary to add a finalizer to the Backup resource on creation and remove it on completing the backup to ensure no dangling PVCs and Snapshots.

@l0wl3vel l0wl3vel added the enhancement New feature or request label Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Planned
Development

No branches or pull requests

1 participant