Backup

Velero is an open-source tool that provides backup, migration, and disaster recovery for Kubernetes clusters and persistent volumes.

Installation

Download the latest stable version from https://github.com/heptio/velero/releases.

For example, with Azure, installing Velero requires the following steps:

(1) Create a storage account

AZURE_BACKUP_RESOURCE_GROUP=Velero_Backups
az group create -n $AZURE_BACKUP_RESOURCE_GROUP --location WestUS

AZURE_STORAGE_ACCOUNT_ID="velero$(uuidgen | cut -d '-' -f5 | tr '[A-Z]' '[a-z]')"
az storage account create \
    --name $AZURE_STORAGE_ACCOUNT_ID \
    --resource-group $AZURE_BACKUP_RESOURCE_GROUP \
    --sku Standard_GRS \
    --encryption-services blob \
    --https-only true \
    --kind BlobStorage \
    --access-tier Hot

BLOB_CONTAINER=velero
az storage container create -n $BLOB_CONTAINER --public-access off --account-name $AZURE_STORAGE_ACCOUNT_ID

(2) Create a service principal

(3) Launch Velero

Backup

Create a regular backup:

Disaster Recovery

Migration

First, create a backup in cluster 1 (the default TTL is 30 days; you can modify it using --ttl):

Next, configure BackupStorageLocations and VolumeSnapshotLocations for cluster 2 to point to the same backup and snapshot paths as cluster 1 and make sure BackupStorageLocations are read-only (--access-mode=ReadOnly). Then wait a moment (the default sync time is 1 minute), until the Backup object is successfully created.

Finally, perform data recovery:

Reference Documents

最后更新于