Crates.io | snap-kube-client |
lib.rs | snap-kube-client |
version | 0.1.1 |
source | src |
created_at | 2024-10-18 17:06:24.620666 |
updated_at | 2024-10-18 17:16:29.994302 |
description | The snap-kube-client is a Rust-based client that can backup and restore Kubernetes PVCs across namespaces using AWS EBS snapshots |
homepage | https://github.com/nikoshet/snap-kube |
repository | https://github.com/nikoshet/snap-kube |
max_upload_size | |
id | 1414471 |
size | 90,270 |
The SnapKube Tool is a Rust-based utility that allows Kubernetes users to backup and restore Persistent Volume Claim (PVC) snapshots. The tool provides robust mechanisms to back up data to AWS Elastic Block Store (EBS) and restore it to any Kubernetes namespace. This tool is designed to work with Kubernetes VolumeSnapshot resources, making backup and restoration operations seamless.
The tool supports three primary modes of operation:
Mode | Description |
---|---|
Backup | Create snapshots of one or more PVCs. |
Restore | Restore PVCs from existing snapshots. |
Full | Run both backup and restore operations in a single process. |
Before using SnapKube, please ensure you have the following:
In order to use the tool as a client, you can use cargo
.
cargo install snap-kube-client
The tool provides 3 features for running it, which are backup
restore
, and full
(default).
Usage: snap-kube-client full [OPTIONS] --source-ns <SOURCE_NS> --target-ns <TARGET_NS> --volume-snapshot-class <VOLUME_SNAPSHOT_CLASS> --volume-snapshot-name-prefix <VOLUME_SNAPSHOT_NAME_PREFIX> --target-snapshot-content-name-prefix <TARGET_SNAPSHOT_CONTENT_NAME_PREFIX> --storage-class-name <STORAGE_CLASS_NAME>
Options:
--region <REGION>
Region where the EBS volumes are stored [default: eu-west-1]
--source-ns <SOURCE_NS>
Source namespace
--target-ns <TARGET_NS>
Target namespace
--volume-snapshot-class <VOLUME_SNAPSHOT_CLASS>
VolumeSnapshotClass name
--pvc-name <PVC_NAME>
PVC name [default: ]
--include-all-pvcs
Include all PVCs in the namespace
--volume-snapshot-name-prefix <VOLUME_SNAPSHOT_NAME_PREFIX>
VolumeSnapshot name prefix
--target-snapshot-content-name-prefix <TARGET_SNAPSHOT_CONTENT_NAME_PREFIX>
Target VolumeSnapshotContent name prefix
--storage-class-name <STORAGE_CLASS_NAME>
StorageClass name
--vsc-retain-policy <VSC_RETAIN_POLICY>
VSC Retain Policy [default: delete] [possible values: retain, delete]
-h, --help
Print help
-V, --version
Print version
To install the tool as a library, you can add it to your Cargo.toml
:
cargo add snap-kube
or
[dependencies]
snap-client = "0.X"
Run the tool:
cargo run full
cargo run --no-default-features --features backup -- backup
cargo run --no-default-features --features restore -- restore
cargo fmt --all
cargo clippy --all
cargo nextest run --all
cargo build
RUST_LOG=info \
cargo run full \
--source-ns "source-ns" \
--target-ns "target-ns" \
--volume-snapshot-class "volumesnapshotclass-name" \
--include-all-pvcs \
--volume-snapshot-name-prefix "prefix-vs" \
--target-snapshot-content-name-prefix "prefix-vsc" \
--storage-class-name "ebs-test-sc"
This project is licensed under the MIT License