Backup and Restore Kubernetes Volumes with Velero Restic Integration

中文版: 使用Velero Restic集成备份及恢复Kubernetes数据卷 – Frank’s Weblog

I built a Kubernetes cluster using OpenEBS as the storage backend. I selected Jiva as the storage engine, Jiva is a high-available storage controller, data is replicated to all nodes. To ensure the safety of the data, I used Velero and its Restic integration to backup the volumes to AWS S3.


To install Velero CLI on your computer, see Velero Docs – Basic Install for install instructions.

Prepare the kubeconfig. The kubeconfig should be placed in .kube/config and make sure kubectl get pod returns the correct result.

Create an AWS credentials file with the following format, this credential should have access to the s3 bucket you provide below, note down the path to the file.


Install Velero to Kubernetes cluster

velero install \
--provider aws \
--plugins velero/velero-plugin-for-aws:v1.5.0 \
--bucket velero \
--secret-file /path/to/aws/cred/file \
--use-volume-snapshots false \
--use-restic \
--backup-location-config region=us-east-1

Backup and Restore

To run a single backup

velero backup create BACKUP_NAME \
  --include-namespaces default \

To create a backup schedule

velero schedule create SCHEDULE_NAME \
  --include-namespaces default \
  --default-volumes-to-restic \
  --schedule="@every 1h"

For more backup options, see Velero Docs – Restic Integration

To restore from a backup

velero restore create --from-backup BACKUP_NAME

Export/Dump Backed up Files

Sometimes restoring directly to the Kubernetes cluster doesn’t work for us. In this case, we can dump the files directly from the backup repository. Since Velero doesn’t provide this functionality in its CLI, we need to use Restic CLI.

Install the Restic CLI

Installation — restic 0.14.0 documentation

Get the snapshot ID, the default password is static-passw0rd

restic snapshots -r

It returns the list of snapshots. Note down the snapshot ID that you’d like to export.

ed17cb1b  2022-08-28 00:00:00  velero      backup=(redacted),backup-uid=(redacted),ns=default,pod=(redacted),pod-uid=(redacted),volume=etc-gitlab-runner                                                          /host_pods/(redacted)/volumes/

You can use ls command to list the files in the snapshot.

restic ls -r ed17cb1b

Dump the files in an archive.

restic dump -a tar -r 4e68ea11 / > ./dump.tar


[1] Velero Docs – Run Velero on AWS

[2] Backup and Restore Stateful Workloads using Velero and Restic | James McLeod

[3] Velero Docs – Restic Integration





发表回复/Leave a Reply

您的电子邮箱地址不会被公开。/Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.