-
Overview
-
Practical sheets
-
-
-
-
-
-
-
- Backup : Agent-Level B&R via NSS for IAAS offer
- Backup : Create VCOD Backup
- Backup : Netbackup Agent Installation for Linux
- Backup : Netbackup Agent Installation for Windows
- Backup : Overall Design for VCOD Offer
- Backup : User's Guide for VCOD Offer
- NSX-T : Configuring a Distributed Firewall [FR]
- NSX-T : Create a VPN Ipsec
- NSX-T : Creation of T1
- NSX-T : DNAT configuration
- NSX-T : How to configure a Gateway Firewall
- NSX-T : SNAT configuration
- NSX-T: Create and Configure a Geneve Overlay Segment [FR]
- NSX-T: How to configure an IPSEC solution
- vCenter : Clone a VM [FR]
- VCenter : Create a new VM
- VCenter : Create a snapshot of a VM
- VCenter : Reset cloudadmin password
- VCenter : Storage Vmotion on a VM
- VCenter : Upgrade Vmware tools on a VM
- Show all articles (5) Collapse Articles
-
-
Q & A
-
Services
- Backup
- Bare metal server
- Block Storage [FR]
- BVPN access
- Certifications [FR]
- Cross Connect [FR]
- Dedicated Cluster
- DRaaS with VCDA
- Dual Site [FR]
- HA Dual-Room
- Internet access
- Kubernetes [FR]
- Licenses
- LoadBalancer As A Service
- Network
- Network Storage
- Object storage
- QoS Appliance
- Security
- Support and Coaching
- Tools [FR]
- VCenter On Demand
- VM Replication [FR]
- Show all articles (8) Collapse Articles
Backup workload with Velero
Introduction
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.
More information about velero : https://velero.io/
Please note !
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.
Then you can extract the file downloaded :
tar -xvf <RELEASE-TARBALL-NAME>.tar.gz
chmod ugo+x <RELEASE-TARBALL-NAME>
mv ./<RELEASE-TARBALL-NAME>/usr/local/bin/velero
Exemple :
tar -xvf velero-linux-v1.7.0+vmware.1.tar.gz
chmod ugo+x velero-linux-v1.7.0+vmware.1
mv ./velero-linux-v1.7.0+vmware.1 /usr/local/bin/velero
Check the installation
# velero version
Client:
Version: v1.7.0_vmware.1
Git commit: 9e52260568430ecb77ac38a677ce74267a8c2176
Server:
Version: v1.7.0_vmware.1
Install velero in the cluster
Create a secret file containing the access & secret key to access your S3 bucket
[default]
aws_access_key_id=<ACCESS_KEY_ID>
aws_secret_access_key=<SECRET_ACCESS_KEY>
Please note !
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.
Start the installation
velero install --provider aws \
--plugins "projects.registry.vmware.com/tkg/velero/velero-plugin-for-aws:v1.3.0_vmware.1" \
--bucket <BUCKET NAME> \
--secret-file ./credentials-velero \
--backup-location-config "region=<REGION>,s3ForcePathStyle=true,s3Url=<YOUR_S3_URL>" \
--snapshot-location-config region="<REGION>"
Example for a minio setup :
velero install --provider aws \
--plugins "projects.registry.vmware.com/tkg/velero/velero-plugin-for-aws:v1.3.0_vmware.1" \
--bucket velero \
--secret-file ./credentials-velero \
--backup-location-config "region=minio,s3ForcePathStyle=true,s3Url=http://100.101.191.4.nip.io" \
--snapshot-location-config region="default"
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.
Backup
For more details, you can rely on the official documentation : https://velero.io/docs
List backups
velero backup get
On-demand backup
Backup all objects
velero backup create mybackup
Backup all objects from a specific namespace
velero backup create <backup-name> --include-namespaces <namespace>
Backup a specific app using labels
velero backup create bananafirstbackup --selector app=banana
Describe and debug a backup
# velero backup describe mybackup
Name: mybackup
Namespace: velero
Labels: velero.io/storage-location=default
Annotations: velero.io/source-cluster-k8s-gitversion=v1.21.2+vmware.1
velero.io/source-cluster-k8s-major-version=1
velero.io/source-cluster-k8s-minor-version=21
Phase: Completed
Errors: 0
Warnings: 0
Namespaces:
Included: *
Excluded: <none>
Resources:
Included: *
Excluded: <none>
Cluster-scoped: auto
Label selector: <none>
Storage Location: default
Velero-Native Snapshot PVs: auto
TTL: 720h0m0s
Hooks: <none>
Backup Format Version: 1.1.0
Started: 2022-03-24 10:48:43 +0000 UTC
Completed: 2022-03-24 10:49:03 +0000 UTC
Expiration: 2022-04-23 10:48:43 +0000 UTC
Total items to be backed up: 1014
Items backed up: 1014
Velero-Native Snapshots: <none included>
Get the logs for a backup
velero backup logs mybackup
Schedule a backup
Cron schedules use the following format.
# ┌───────────── minute (0 - 59)
# │ ┌───────────── heure (0 - 23)
# │ │ ┌───────────── jour du mois (1 - 31)
# │ │ │ ┌───────────── mois (1 - 12)
# │ │ │ │ ┌───────────── jour de la semaine (0 - 6) (Dimanche au Samedi;
# │ │ │ │ │ 7 est également dimanche sur certains systèmes)
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
velero schedule create NAME --schedule="* * * * *" [options]
For example, the command below creates a backup that runs every day at 3am.
velero schedule create example-schedule --schedule="0 3 * * *"
Restore
To restore the entire backup on same namespace
velero restore create RESTORE_NAME --from-backup BACKUP_NAME
To restore the entire backup on another namespace
velero restore create RESTORE_NAME --from-backup BACKUP_NAME
Please note !
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.
kubectl patch cluster workload_cluster_name --type='merge' -p '{"spec":{"paused": true}}'