This is the documentation for the latest development version of Velero. Both code and docs may be unstable, and these docs are not guaranteed to be up to date or correct. See the latest version.
The following example sets up the Velero server and client, then backs up and restores a sample application.
For simplicity, the example uses Minio, an S3-compatible storage service that runs locally on your cluster. For additional functionality with this setup, see the docs on how to expose Minio outside your cluster.
NOTE The example lets you explore basic Velero functionality. Configuring Minio for production is out of scope.
See Set up Velero on your platform for how to configure Velero for a production environment.
If you encounter issues with installing or configuring, see Debugging Installation Issues.
velero backup delete.
Download the latest official release’s tarball for your client platform.
We strongly recommend that you use an official release of
Velero. The tarballs for each release contain the
velero command-line client. The code in the master branch
of the Velero repository is under active development and is not guaranteed to be stable!
tar -xvf <RELEASE-TARBALL-NAME>.tar.gz -C /dir/to/extract/to
We’ll refer to the directory you extracted to as the “Velero directory” in subsequent steps.
velerobinary from the Velero directory to somewhere in your PATH.
On Mac, you can use HomeBrew to install the
brew install velero
These instructions start the Velero server and a Minio instance that is accessible from within the cluster only. See Expose Minio outside your cluster for information about configuring your cluster for outside access to Minio. Outside access is required to access logs and run
velero describe commands.
Create a Velero-specific credentials file (
credentials-velero) in your local directory:
[default] aws_access_key_id = minio aws_secret_access_key = minio123
Start the server and the local storage service. In the Velero directory, run:
kubectl apply -f config/minio/00-minio-deployment.yaml velero install \ --provider aws \ --bucket velero \ --secret-file ./credentials-velero \ --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://minio.velero.svc:9000 \
Additionally, you can specify
--use-restic to enable restic support, and
--wait to wait for the deployment to be ready.
Once the installation is complete, remove the default
VolumeSnapshotLocation that was created by
velero install, since it’s not relevant for this scenario:
kubectl -n velero delete volumesnapshotlocation.velero.io default
Deploy the example nginx application:
kubectl apply -f config/nginx-app/base.yaml
Check to see that both the Velero and nginx deployments are successfully created:
kubectl get deployments -l component=velero --namespace=velero kubectl get deployments --namespace=nginx-example
Create a backup for any object that matches the
app=nginx label selector:
velero backup create nginx-backup --selector app=nginx
Alternatively if you want to backup all objects except those matching the label
velero backup create nginx-backup --selector 'backup notin (ignore)'
(Optional) Create regularly scheduled backups based on a cron expression using the
app=nginx label selector:
velero schedule create nginx-daily --schedule="0 1 * * *" --selector app=nginx
Alternatively, you can use some non-standard shorthand cron expressions:
velero schedule create nginx-daily --schedule="@daily" --selector app=nginx
See the cron package’s documentation for more usage examples.
Simulate a disaster:
kubectl delete namespace nginx-example
To check that the nginx deployment and service are gone, run:
kubectl get deployments --namespace=nginx-example kubectl get services --namespace=nginx-example kubectl get namespace/nginx-example
You should get no results.
NOTE: You might need to wait for a few minutes for the namespace to be fully cleaned up.
velero restore create --from-backup nginx-backup
velero restore get
After the restore finishes, the output looks like the following:
NAME BACKUP STATUS WARNINGS ERRORS CREATED SELECTOR nginx-backup-20170727200524 nginx-backup Completed 0 0 2017-07-27 20:05:24 +0000 UTC <none>
NOTE: The restore can take a few moments to finish. During this time, the
STATUS column reads
After a successful restore, the
STATUS column is
ERRORS are 0. All objects in the
nginx-example namespace should be just as they were before you deleted them.
If there are errors or warnings, you can look at them in detail:
velero restore describe <RESTORE_NAME>
For more information, see the debugging information.
If you want to delete any backups you created, including data in object storage and persistent volume snapshots, you can run:
velero backup delete BACKUP_NAME
This asks the Velero server to delete all backup data associated with
BACKUP_NAME. You need to do
this for each backup you want to permanently delete. A future version of Velero will allow you to
delete multiple backups by name or label selector.
Once fully removed, the backup is no longer visible when you run:
velero backup get BACKUP_NAME
If you want to uninstall Velero but preserve the backup data in object storage and persistent volume
snapshots, it is safe to remove the
velero namespace and everything else created for this
kubectl delete -f config/common/ kubectl delete -f config/minio/ kubectl delete -f config/nginx-app/base.yaml