Back up workloads with Velero
Back up the cluster's objects and the files of its volumes into one of your buckets every day with the velero add-on, and restore them into this or another cluster.
Replace my-cluster with your cluster's name or id and my-backups with one of your buckets.
Deutsche Cloud backs up the control plane itself (etcd, see Back up a cluster).
The velero add-on is for your workloads: it copies every namespace's objects and, with
file-system backup, the files in your pods' volumes into a bucket you choose, on a schedule.
- No key in the cluster. Velero gets temporary object-storage credentials from Deutsche Cloud for
its service-account token. They belong to the IAM service account
eks-velero-<cluster id>, which the add-on makes, whose one policy is your bucket under the prefix, and which goes when the add-on or the cluster goes. - The schedule
ews-dailyruns at 03:00 UTC unless you setschedule, and keeps each backupretentionDays(30). - File-system backup (on by default) copies volume files with Kopia, because Deutsche Cloud volumes
have no snapshots. It runs a node agent on every node that is privileged and reads every pod
volume on its node. Turn
fileSystemBackupoff to back up objects only.
Prerequisites
- A bucket in your organization.
- Permission for
eks:CreateAddonon the cluster ands3:PutObjectin the bucket under the prefix (defaultvelero/<cluster id>). In the console, alsoeks:DescribeClusterto open the cluster. - The velero CLI for restores, or
kubectlto create a Restore object.
Install the add-on
- Open Kubernetes, open the cluster, then choose Add-ons.
- Choose Add an add-on, then Backups (Velero).
- Enter the bucket, and change the prefix, schedule or retention if you want.
- Choose Install.
dcloud eks addons create my-cluster --name velero --config 'bucket="my-backups"' --config 'retentionDays=14'POST /eks/api/clusters/my-cluster/addons
{ "name": "velero", "config": { "bucket": "my-backups", "retentionDays": 14 } }resource "dcloud_eks_addon" "velero" {
cluster_id = dcloud_eks_cluster.main.id
name = "velero"
config = jsonencode({ bucket = "my-backups", retentionDays = 14 })
}Back up now and restore
velero backup create before-upgrade --wait
velero backup describe before-upgrade --details
velero restore create --from-backup before-upgrade --include-namespaces shop --waitVelero restores what is missing and leaves what exists; delete a namespace first to restore it as it was.
Into another cluster: install the add-on there with the same bucket and the first cluster's
prefix (velero/<first cluster id>); its backups appear in velero backup get within a minute.
Use another prefix for the new cluster's own backups afterwards, so the two do not mix.
Remove
Removing the add-on deletes Velero, its namespace (with the Backup and Restore objects in it), its
schedule and its IAM service account. The backups themselves stay in the bucket: install the
add-on again with the same bucket and prefix and they are listed again within about a minute. To
delete backups for good, use velero backup delete before removing the add-on, or delete the
objects under the prefix in the bucket.