This project provides tools to back up and restore Kubernetes PVCs using Restic and MinIO.
-
accelerated-backup/: Contains accelerated I/O backup logic and related configurations.
accelerated_io.go: Core logic for accelerated backups.example/: Example YAML files for Kubernetes jobs and configurations.backup-job.yaml: Example backup job configuration.restore-job.yaml: Example restore job configuration.lvm.yaml: Logical Volume Manager configuration.minio-credentials.yaml: MinIO credentials for S3 storage.restic-init-job.yaml: Restic initialization job.restic-testing.yaml: Testing configuration for Restic.
-
bin/: Contains the compiled binary
restic-backup. -
cmd/: Contains the main entry point for the application (
main.go). -
pkg/: Contains reusable packages for backup, restore, Kubernetes interactions, and utilities.
backup/: Logic for handling backups.restore/: Logic for handling restores.k8s/: Kubernetes-specific utilities.logutil/: Logging utilities.manifests/: Manages Kubernetes manifests.find/: Helper functions for finding and managing resources.
To back up a PVC:
$ ./bin/restic-backup \
-awsid <AWS_ACCESS_KEY_ID> \
-awssecret <AWS_SECRET_ACCESS_KEY> \
-password <RESTIC_PASSWORD> \
-repository s3:<S3_ENDPOINT>/<BUCKET_NAME> \
-mode backup \
-pvc <PVC_NAME> \
-vsc <VOLUME_SNAPSHOT_CLASS> \
-namespace <NAMESPACE> \
-snapshot <SNAPSHOT_TAG>Example:
$ ./bin/restic-backup \
-awsid minioadmin \
-awssecret minioadmin \
-password abc \
-repository s3:http://192.188.0.56:9000/restic-testing \
-mode backup \
-pvc vol1 \
-vsc lvm-snapshot \
-namespace backup \
-snapshot s1To restore a PVC:
$ ./bin/restic-backup \
-awsid <AWS_ACCESS_KEY_ID> \
-awssecret <AWS_SECRET_ACCESS_KEY> \
-password <RESTIC_PASSWORD> \
-repository s3:<S3_ENDPOINT>/<BUCKET_NAME> \
-mode restore \
-pvc <PVC_NAME> \
-sourcepv <SOURCE_PV_NAME> \
-sourcens <SOURCE_NAMESPACE> \
-namespace <NAMESPACE> \
-snapshot <SNAPSHOT_TAG>Example:
$ ./bin/restic-backup \
-awsid minioadmin \
-awssecret minioadmin \
-password abc \
-repository s3:http://192.188.0.56:9000/restic-testing \
-mode restore \
-pvc vol2 \
-sourcepv pvc-c42288e1-aa3e-4022-8e2c-f426b14099dd \
-sourcens backup \
-namespace backup \
-snapshot s1Example YAML files for Kubernetes jobs and configurations can be found in the accelerated-backup/example/ directory. These include:
backup-job.yaml: Defines a Kubernetes job for performing backups.restore-job.yaml: Defines a Kubernetes job for restoring backups.lvm.yaml: Configuration for Logical Volume Manager (LVM).minio-credentials.yaml: Credentials for accessing MinIO S3 storage.restic-init-job.yaml: Initialization job for Restic.restic-testing.yaml: Testing configuration for Restic.
- Kubernetes cluster with PVCs.
- MinIO or compatible S3 storage.
- Restic installed and configured.
To build the project, use the makefile in the root directory:
$ make buildThe compiled binary will be available in the bin/ directory.