Velero provides comprehensive backup and restore capability for Kubernetes clusters — covering both resource definitions and persistent volume data. This guide covers setting it up on a self-hosted VPS-based cluster.
Why Kubernetes Needs Dedicated Backup Tooling
Simply backing up etcd (Kubernetes' underlying data store) doesn't capture everything meaningfully — Velero provides application-consistent backup of both Kubernetes resources (deployments, services, configmaps) and associated persistent volume data, plus selective/namespace-scoped restore capability.
Prerequisites
- A working Kubernetes cluster (see How to Install kubeadm and Set Up a Multi-Node Kubernetes Cluster)
- S3-compatible object storage for backup destination (see How to Set Up Self-Hosted S3-Compatible Object Storage with MinIO for self-hosted option)
Step 1 — Install the Velero CLI
curl -fsSL -o velero.tar.gz https://github.com/vmware-tanzu/velero/releases/download/v1.13.0/velero-v1.13.0-linux-amd64.tar.gz
tar -xzf velero.tar.gz
sudo mv velero-v1.13.0-linux-amd64/velero /usr/local/bin/
Step 2 — Install Velero into the Cluster
velero install \
--provider aws \
--plugins velero/velero-plugin-for-aws:v1.9.0 \
--bucket velero-backups \
--backup-location-config region=minio,s3ForcePathStyle=true,s3Url=http://your-minio-endpoint:9000 \
--secret-file ./credentials-velero
Even for S3-compatible (non-AWS) storage like self-hosted MinIO, Velero's AWS-compatible plugin works via the S3-compatible API, a common pattern for self-hosted backup destinations.
Step 3 — Create Your First Backup
velero backup create initial-backup
Step 4 — Check Backup Status
velero backup describe initial-backup
velero backup logs initial-backup
Step 5 — Schedule Recurring Backups
velero schedule create daily-backup --schedule="0 2 * * *"
See How to Set Up Automated Backup Verification and Alerting for the general principle applied here — manual one-off backups aren't sufficient for genuine disaster recovery preparedness; automate on a schedule.
Backing Up Specific Namespaces Only
velero backup create app-backup --include-namespaces production
Useful if you want separate backup policies for different namespaces, or don't need every namespace (some may hold genuinely ephemeral/reproducible resources not worth backing up).
Restoring from a Backup
velero restore create --from-backup initial-backup
Restores the backed-up resources and persistent volume data — test this process (see How to Test a Full Disaster Recovery Scenario (Fire Drill)) in a non-production context before relying on it during a genuine emergency.
Backing Up Persistent Volume Data
Velero can integrate with your storage provider's native snapshot capability, or use file-level backup (restic/kopia integration) depending on your setup — verify your specific persistent volume backend is properly supported for the data (not just resource definitions) to be genuinely captured.
Setting Retention for Backups
velero backup create weekly-backup --schedule="0 3 * * 0" --ttl 720h0m0s
--ttl controls how long a backup is retained before automatic deletion — balance genuine recovery needs against storage cost, similar to general backup retention considerations covered elsewhere in this Knowledge Base.
Common Errors
Backup completes but persistent volume data isn't actually included — verify your storage provider's CSI driver supports Velero's volume snapshot mechanism, or that restic/kopia file-level backup is properly configured if your storage backend doesn't support native snapshots.
Continue Reading
- How to Manage Persistent Storage in Kubernetes (PersistentVolumes & PVCs)
- How to Test a Full Disaster Recovery Scenario (Fire Drill)
- How to Set Up Self-Hosted S3-Compatible Object Storage with MinIO
Browse more articles in Kubernetes & Container Orchestration.