Velero is an open source tool to safely back up, recover, and migrate Kubernetes clusters and persistent volumes. Velero consists of a server process running as a deployment in your Kubernetes cluster and a command-line interface (CLI) with which DevOps teams and platform operators configure scheduled backups, trigger ad-hoc backups, perform restores, and more.
Unlike other tools which directly access the Kubernetes etcd database to perform backups and restores, Velero uses the Kubernetes API to capture the state of cluster resources and to restore them when necessary. This API-driven approach has a number of key benefits:
Backups can capture subsets of the cluster’s resources, filtering by namespace, resource type, and/or label selector, providing a high degree of flexibility around what’s backed up and restored.
Resources exposed through aggregated API servers can easily be backed up and restored even if they’re stored in a separate etcd database.
This practical sheets is given as information only, Velero is not mandatory at all, you are free to install any other backup/restore tool on your clusters. No support can be provided on Velero.
Prérequis
An S3 bucket accessible by the cluster as velero store the backups and snapshots in this storage
Please find the list of compatible storage here https://velero.io/docs/v1.6/supported-providers/
For test purpose, you can deploy a minio server to act as a storage object.
Installation
Command line tool
Velero is managed through a command line tool installed on your admin workstation. The tool use the current kubectl config to connect to the kubernetes cluster to make backup, create schedule and restore
ABefore to start the velero binary must be downloaded from the VMware Website, a free account is required and must be created before.
Even it the variable name include the text AWS you can others object storage compatible. Please find the list here https://velero.io/docs/v1.6/supported-providers/ For test purpose, you can deploy a minio server to act as a storage object.
I0324 09:15:17.781299 2971533 request.go:655] Throttling request took 1.110498807s, request: GET:https://100.101.250.5:6443/apis/policy/v1?timeout=32s CustomResourceDefinition/backups.velero.io: attempting to create resource CustomResourceDefinition/backups.velero.io: attempting to create resource client CustomResourceDefinition/backups.velero.io: created CustomResourceDefinition/backupstoragelocations.velero.io: attempting to create resource CustomResourceDefinition/backupstoragelocations.velero.io: attempting to create resource client CustomResourceDefinition/backupstoragelocations.velero.io: created CustomResourceDefinition/deletebackuprequests.velero.io: attempting to create resource CustomResourceDefinition/deletebackuprequests.velero.io: attempting to create resource client CustomResourceDefinition/deletebackuprequests.velero.io: created CustomResourceDefinition/downloadrequests.velero.io: attempting to create resource CustomResourceDefinition/downloadrequests.velero.io: attempting to create resource client CustomResourceDefinition/downloadrequests.velero.io: created CustomResourceDefinition/podvolumebackups.velero.io: attempting to create resource CustomResourceDefinition/podvolumebackups.velero.io: attempting to create resource client CustomResourceDefinition/podvolumebackups.velero.io: created CustomResourceDefinition/podvolumerestores.velero.io: attempting to create resource CustomResourceDefinition/podvolumerestores.velero.io: attempting to create resource client CustomResourceDefinition/podvolumerestores.velero.io: created CustomResourceDefinition/resticrepositories.velero.io: attempting to create resource CustomResourceDefinition/resticrepositories.velero.io: attempting to create resource client CustomResourceDefinition/resticrepositories.velero.io: created CustomResourceDefinition/restores.velero.io: attempting to create resource CustomResourceDefinition/restores.velero.io: attempting to create resource client CustomResourceDefinition/restores.velero.io: created CustomResourceDefinition/schedules.velero.io: attempting to create resource CustomResourceDefinition/schedules.velero.io: attempting to create resource client CustomResourceDefinition/schedules.velero.io: created CustomResourceDefinition/serverstatusrequests.velero.io: attempting to create resource CustomResourceDefinition/serverstatusrequests.velero.io: attempting to create resource client CustomResourceDefinition/serverstatusrequests.velero.io: created CustomResourceDefinition/volumesnapshotlocations.velero.io: attempting to create resource CustomResourceDefinition/volumesnapshotlocations.velero.io: attempting to create resource client CustomResourceDefinition/volumesnapshotlocations.velero.io: created Waiting for resources to be ready in cluster... Namespace/velero: attempting to create resource Namespace/velero: attempting to create resource client Namespace/velero: created ClusterRoleBinding/velero: attempting to create resource ClusterRoleBinding/velero: attempting to create resource client ClusterRoleBinding/velero: created ServiceAccount/velero: attempting to create resource ServiceAccount/velero: attempting to create resource client ServiceAccount/velero: created Secret/cloud-credentials: attempting to create resource Secret/cloud-credentials: attempting to create resource client Secret/cloud-credentials: created BackupStorageLocation/default: attempting to create resource BackupStorageLocation/default: attempting to create resource client BackupStorageLocation/default: created VolumeSnapshotLocation/default: attempting to create resource VolumeSnapshotLocation/default: attempting to create resource client VolumeSnapshotLocation/default: created Deployment/velero: attempting to create resource Deployment/velero: attempting to create resource client Deployment/velero: created Velero is installed! ⛵ Use 'kubectl logs deployment/velero -n velero' to view the status.
It is also possible to use resource filtering during restore (–include-namespaces, –selector)…
Backup & Restore Management cluster
You can backup and restore management cluster with velero, the cluster api CustomResourceDefination will be backup and restored.
In order to not make duplicate resources you can ignore these namespaces : capi-kubeadm-bootstrap-system, capi-kubeadm-control-plane-system, capi-system, capvcd-system
Before starting the backup it is recommended to put in pause mode all your workload clusters on the management cluster to avoid modification of the objects during the backup.
/!\ There is no impact on your workloads, just on the management of this workload clusters.