Back up your Kapsule cluster on Object Storage with Velero
Velero is an open-source utility designed to facilitate the backup, restoration, and migration of Kubernetes cluster resources and persistent volumes on Amazon S3-compatible Object Storage. Originally developed by Heptio, it became part of VMware following an acquisition. Velero offers a straightforward and effective approach to protecting your Kubernetes applications and data through regular backups and supporting disaster recovery measures.
With Velero, users can generate either scheduled or on-demand backups encompassing the entire cluster or specific namespaces. These backups comprehensively capture the state of all resources within the cluster, including deployments, services, config maps, secrets, and persistent volumes. Velero ensures the preservation of associated metadata and labels, guaranteeing the completeness and accuracy of the backups for potential restoration.
Beyond backups, Velero allows users to restore applications and data either within the same Kubernetes cluster or to different clusters. This capability proves valuable in diverse scenarios, such as recovering from accidental deletions, migrating applications between clusters, or implementing robust disaster recovery plans.
Velero seamlessly integrates with Kubernetes through custom resource definitions (CRDs) and operates as a deployment within the cluster. Leveraging plugins, Velero addresses various aspects of backup and restore operations, allowing for flexibility, extensibility, and customization.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- A valid API key
- Created an Object Storage bucket
- Created a Kapsule cluster
- Set up kubectl on your machine
Installation of Velero
Velero will be installed on your local PC or Mac.
-
Download the latest Velero release for your platform from Veleros GitHub repository.
-
Extract the tarball:
tar -xvf <RELEASE-TARBALL-NAME>.tar.gz
-
Move the extracted
velero
binary to the desired location in your$PATH
(/usr/local/bin
for most users).
Configuration of Velero
-
Create a credentials file for Velero, named
velero-credentials
:nano velero-credentials
-
Copy the following content in the file and set your access key and secret key. Then save the file and exit the text editor.
[default] aws_access_key_id=SCALEWAY_ACCESS_KEY aws_secret_access_key=SCALEWAY_SECRET_KEY
-
Initialize Verlero. Make sure to replace
VELERO-BUCKET-NAME
with the name of the Object Storage bucket you want to use. Edit the backup location if your bucket is in a zone other thanfr-par
.velero install \ --provider velero.io/aws \ --bucket k8s-velero-backup \ --plugins velero/velero-plugin-for-aws:v1.7.0 \ --backup-location-config s3Url=https://s3.fr-par.scw.cloud,region=fr-par \ --use-volume-snapshots=false \ --secret-file=./velero-credentials
Verlero is being installed on your Kubernetes cluster. The following message displays, once the installation is complete:
Velero is installed! ⛵ Use 'kubectl logs deployment/velero -n velero' to view the status.
Making backups using Velero
- Create a backup of all namespaces in the cluster:
velero backup create full-backup --include-namespaces '*'
- Check the status of the backup using the
velero get backup
command:When you go to your Object Storage bucket in the Scaleway console, you notice the$ velero get backup NAME STATUS ERRORS WARNINGS CREATED EXPIRES STORAGE LOCATION SELECTOR full-backup Completed 0 0 2023-06-02 15:33:45 +0200 CEST 29d default <none>
backup
folder created by Velero:
Restoring using Verlero
-
Create a restore job from the full backup made in the previous step:
velero restore create full-restore --from-backup full-backup
-
Check the status of your restore:
velero restore describe full-restore
When the
Phase
status changes toCompleted
, your backup has been restored successfully:Phase: Completed
For more information about restoring your data using Velero, refer to the Velero restore reference documentation.
Visit our Help Center and find the answers to your most frequent questions.
Visit Help Center