πΉ 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
Take a backup from source cluster
velero backup create cluster-backup
Transfer the backup (if using MinIO or external storage).
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
Feature | Velero | Kasten K10 | Stash |
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.