Velero: Kubernetes Backup & Restore Solution

Nayan TankNayan Tank
4 min read

🔹 What is Velero?

Velero is an open-source tool for backing up, restoring, and migrating Kubernetes clusters and persistent volumes. It is widely used for disaster recovery, cluster migrations, and protecting Kubernetes workloads.


🔹 Key Features of Velero

Backup Kubernetes Clusters – Save snapshots of your cluster's resources and persistent data.
Restore Workloads – Recover applications and data after failures or accidental deletions.
Migrate Applications – Move workloads from one cluster to another.
Disaster Recovery – Protect against data loss, hardware failures, or cloud outages.
Schedule Backups – Automate regular backups for better resilience.


🔹 How Velero Works

Velero consists of:
1️⃣ A Server Component – Runs inside the cluster to manage backups and restores.
2️⃣ A CLI Tool – Used to interact with the Velero server.
3️⃣ A Backup Storage Location – Stores backups in object storage (S3, Azure Blob, Google Cloud Storage, MinIO, etc.).

It backs up:

  • Kubernetes objects (Deployments, Services, ConfigMaps, Secrets, etc.).

  • Persistent volumes (PVs) using snapshots (if configured).


🔹 Installation of Velero

1️⃣ Install Velero CLI

On macOS/Linux:

brew install velero

On Windows (via Chocolatey):

choco install velero

Alternatively, use the official install script:

curl -L -o /tmp/velero.tar.gz https://github.com/vmware-tanzu/velero/releases/download/v1.15.2/velero-v1.15.2-linux-arm64.tar.gz 
tar -C /tmp -xvf /tmp/velero.tar.gz
mv /tmp/velero-v1.15.2-linux-arm64/velero /usr/local/bin/velero
chmod +x /usr/local/bin/velero

velero --help

Verify installation:

velero version

🔹Deploy some stuff

kind create cluster --name velero --image kindest/node:v1.19.1

docker run -it --rm -v ${HOME}:/root/ -v ${PWD}:/work -w /work --net host alpine sh

# install curl & kubectl
apk add --no-cache curl nano
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
export KUBE_EDITOR="nano"

#test cluster access:
/work # kubectl get nodes
NAME                    STATUS   ROLES    AGE   VERSION
velero-control-plane   Ready    master   26m   v1.18.4


kubectl apply -f kubernetes/configmaps/configmap.yaml
kubectl apply -f kubernetes/secrets/secret.yaml
kubectl apply -f kubernetes/deployments/deployment.yaml
kubectl apply -f kubernetes/services/service.yaml

kubectl get all

🔹 Setting Up Velero for AWS (Example)

2️⃣ Configure Backup Storage (AWS S3 Example)


cat > /tmp/credentials-velero <<EOF
[default]
aws_access_key_id=$AWS_ACCESS_ID
aws_secret_access_key=$AWS_ACCESS_KEY
EOF

velero install \
    --provider aws \
    --plugins velero/velero-plugin-for-aws:v1.1.0 \
    --bucket $BUCKET \
    --backup-location-config region=$REGION \
    --snapshot-location-config region=$REGION \
    --secret-file /tmp/credentials-velero

kubectl -n velero get pods
kubectl logs deployment/velero -n velero
  • Replace aws with gcp, azure, or minio for other providers.

🔹 Basic Operations

3️⃣ Backup a Namespace

velero backup create default-namespace-backup --include-namespaces default

# describe
velero backup describe default-namespace-backup

# logs
velero backup logs default-namespace-backup

# list 
velero backup get

4️⃣ Restore from Backup

# delete all resources

kubectl delete -f kubernetes/configmaps/configmap.yaml
kubectl delete -f kubernetes/secrets/secret.yaml
kubectl delete -f kubernetes/deployments/deployment.yaml
kubectl delete -f kubernetes/services/service.yaml

velero restore create default-namespace-backup --from-backup default-namespace-backup

# describe
velero restore describe default-namespace-backup

# logs 
velero restore logs default-namespace-backup

# monitor restore
velero restore get

# see items restored
kubectl get all

5️⃣ Schedule Automatic Backups

velero schedule create daily-backup --schedule="0 2 * * *"
  • Runs a backup daily at 2 AM.

6️⃣ Migrate Workloads to Another Cluster

  1. Take a backup from source cluster

     velero backup create cluster-backup
    
  2. Transfer the backup (if using MinIO or external storage).

  3. Restore in the destination cluster

     velero restore create --from-backup cluster-backup
    

🔹 Velero Use Cases

Disaster Recovery – Restore your cluster after failures.
Cluster Migration – Move workloads between Kubernetes clusters.
Data Protection – Schedule backups to avoid accidental data loss.
Rolling Back Changes – Restore previous application states.


🔹 Comparison: Velero vs Kasten K10 vs Stash

FeatureVeleroKasten K10Stash
Backup Kubernetes Objects✅ Yes✅ Yes✅ Yes
Backup Persistent Volumes✅ Yes✅ Yes✅ Yes
Multi-Cloud Support✅ Yes✅ Yes✅ Yes
Data Encryption❌ No✅ Yes✅ Yes
UI Dashboard❌ No (CLI only)✅ Yes❌ No
Open Source✅ Yes❌ No (Commercial)✅ Yes

🔹 Conclusion

Velero is a powerful, open-source backup and restore solution for Kubernetes. It provides simple, CLI-based backup management and supports multi-cloud storage solutions.

1
Subscribe to my newsletter

Read articles from Nayan Tank directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nayan Tank
Nayan Tank

Hi there! I'm a DevOps engineer. My expertise lies in deploying, automating, and maintaining infrastructure, as well as optimizing delivery pipelines. I've worked with a range of tools, including AWS, Docker, Kubernetes, and Ansible. In my spare time, I love experimenting with new technologies.