Velero: Backup and Restore Kubernetes

Khimananda Oli 6 min read Virtualization
Velero: Backup and Restore Kubernetes

By Khimananda Oli | Last reviewed: August 2026

Cluster state is ephemeral, but business data cannot be. When a misconfigured Helm upgrade wipes a namespace or a node failure corrupts persistent volumes, you need a verified recovery path immediately. Implementing Velero: Backup and Restore Kubernetes provides that safety net by capturing both API resources and volume data into object storage. This guide covers the production-grade configuration required to make your cluster truly resilient.

Kubernetes ClusterAPI ServerVelero ServerNode Agent (Kopia)Object Storage (S3)Backup Metadata + DataUpload ArtifactsCSI Snapshot ProviderCloud Volume SnapshotsTrigger Snapshots
High-level architecture of Velero: Backup and Restore Kubernetes showing data flow between the cluster, object storage, and cloud provider snapshot APIs.

How do you install Velero for Kubernetes backup?

Installation requires two components: the CLI on your workstation and the server-side controller in the cluster. Before running any commands, verify you have access to an S3-compatible bucket (AWS S3, MinIO, Ceph RGW, or Cloudflare R2). For teams managing Kubernetes persistent volumes and storage, ensuring your storage class supports CSI snapshots is critical for efficient backups.

Create the credentials secret

Velero needs programmatic access to your object storage. Create a file named credentials-velero with your cloud provider keys. Never commit this file to version control.

[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Install the server components

Use the CLI to deploy Velero into the velero namespace. This command configures the backup location, enables CSI support, and sets up the node agent for filesystem-level backups when snapshots are unavailable.

velero install \
  --provider aws \
  --plugins velero/velero-plugin-for-aws:v1.10.0 \
  --bucket my-k8s-backups \
  --secret-file ./credentials-velero \
  --backup-location-config region=us-east-1,s3ForcePathStyle=true,s3Url=https://s3.us-east-1.amazonaws.com \
  --use-node-agent \
  --default-volumes-to-fs-backup \
  --features=EnableCSI

Verify the deployment status. All pods in the velero namespace must reach Running state before attempting backups. If the server pod crashes repeatedly, check the logs for IAM permission errors or incorrect bucket endpoints.

How does Velero handle persistent volume backups?

Backing up YAML manifests is trivial; preserving stateful data is where most failures occur. Velero offers two distinct mechanisms for handling Persistent Volumes (PVs), and choosing the wrong one leads to either excessive costs or unacceptably long recovery times.

Backup RequestCSI Snapshot PathCloud-native API callFast, incremental, low CPUFilesystem Backup PathKopia/Restic tarball uploadSlower, high I/O, portableEBS/GCE/Azure Disk SnapStored in cloud providerS3 Object StorageEncrypted deduplicated blobs
Decision flow for Velero: Backup and Restore Kubernetes persistent volumes comparing CSI snapshot efficiency against filesystem backup portability.

CSI snapshots vs. filesystem backups

Understanding this trade-off prevents operational surprises during recovery drills.

FeatureCSI SnapshotsFilesystem (Kopia/Restic)
SpeedNear-instant (metadata only)Proportional to data size
Storage LocationCloud provider block storageS3/Object storage bucket
Cross-cloud RestoreNo (vendor locked)Yes (fully portable)
PrerequisitesCSI driver + SnapshotClassNode agent DaemonSet
Cost ImpactSnapshot storage fees applyOnly object storage costs

In practice, I recommend a hybrid approach. Use CSI snapshots for large databases on managed cloud infrastructure where restore speed matters most. Use filesystem backups for smaller stateful sets, cross-region DR scenarios, or on-prem clusters lacking native snapshot APIs. Always validate that your Kubernetes secrets management strategy accounts for encrypted volume data during these transfers.

How do you automate scheduled backups and retention?

Manual backups fail because humans forget. Production clusters require declarative schedules defined as Kubernetes resources. This ensures backup policies survive cluster upgrades and operator turnover.

Define a backup schedule

Create a Schedule resource using cron syntax. This example runs daily at 2 AM UTC, retains backups for 30 days, and includes all namespaces except kube-system.

apiVersion: velero.io/v1
kind: Schedule
metadata:
  name: daily-cluster-backup
  namespace: velero
spec:
  schedule: "0 2 * * *"
  template:
    ttl: 720h0m0s
    excludedNamespaces:
      - kube-system
      - velero
    includeClusterResources: true
    storageLocation: default
    volumeSnapshotLocations:
      - default

Monitor backup health

A scheduled backup that silently fails is worse than no backup at all. Integrate Velero metrics into your existing observability stack. If you are already running Prometheus and Grafana monitoring, enable the Velero metrics endpoint and import the official dashboard. Alert on velero_backup_last_status != 1 to catch failures immediately.

  • TTL enforcement: Verify old backups are actually deleted to prevent runaway storage costs.
  • Partial failures: Investigate warnings in backup logs; they often indicate RBAC gaps or missing CRDs.
  • Duration trends: Rising backup times signal storage performance degradation or network bottlenecks.

How do you test and execute a Kubernetes restore?

An untested backup is merely a hope. You must regularly validate that your Velero: Backup and Restore Kubernetes pipeline actually recovers functional workloads. Testing reveals hidden dependencies, missing ConfigMaps, and broken PVC bindings before a real emergency strikes.

1. Select Backupvelero backup get2. Create RestoreNamespace mapping3. Provision PVsSnap/DL + Rebind4. Validate StatePods Running + Data OKCommon Pitfall: StorageClass mismatch causes Pending PVCsFix: Use --storage-class-mapping flag during restore
Four-stage restore sequence for Velero: Backup and Restore Kubernetes highlighting storage class mapping as a critical success factor.

Execute a targeted restore

Full cluster restores are rare. Usually, you need to recover a specific namespace after an accidental deletion. Map the source namespace to a new target to avoid conflicts with existing resources during testing.

velero restore create staging-db-restore \
  --from-backup daily-cluster-backup-20260814 \
  --include-namespaces production-db \
  --namespace-mappings production-db:staging-db-restored \
  --wait

Validate data integrity

Pod readiness probes passing does not guarantee data correctness. After the restore completes:

  1. Check PVC binding status with kubectl get pvc -n staging-db-restored.
  2. Exec into database pods and verify record counts match pre-backup baselines.
  3. Review application logs for connection errors or missing configuration.
  4. Delete the test namespace once validation succeeds to free resources.

Document every restore test. Note the duration, any manual interventions required, and discrepancies found. This runbook becomes invaluable during actual incidents when stress levels are high and cognitive load is maxed out.

Making Velero: Backup and Restore Kubernetes Production-Ready

Deploying Velero is straightforward; keeping it reliable requires discipline. Treat your backup infrastructure with the same rigor as your primary workloads. Automate schedule creation via GitOps, monitor backup success rates alongside your four golden signals, and conduct quarterly restore drills. Security matters too—encrypt backups at rest, restrict S3 access with least-privilege IAM policies, and audit restore operations. If your team lacks confidence in executing these steps or needs help designing a compliant DR strategy, reach out to discuss your infrastructure requirements. A tested backup is the only backup that counts.

Frequently Asked Questions

Velero is an open-source tool that backs up cluster resources, persistent volumes, and namespaces. It enables disaster recovery, cluster migration, and compliance by storing snapshots in object storage like S3 or GCS independently of the underlying infrastructure provider.

Install via Helm chart or the velero CLI using version 1.15 or later. Configure cloud provider credentials, specify backup storage location, and deploy volume snapshot classes. Verify installation with velero get backup-locations to confirm connectivity before scheduling production backups.

Yes, if CSI volume snapshots are enabled and configured correctly. Velero triggers native cloud provider snapshots during backup. Without proper StorageClass annotations or snapshot controller setup, only metadata persists while actual volume data remains unprotected during restore operations.

Absolutely. Velero supports cross-cluster migration by restoring backups into any compatible cluster. Ensure target cluster has matching storage classes, namespace quotas, and CRDs installed beforehand to prevent resource conflicts or failed restores during disaster recovery scenarios.

Schedule based on RPO requirements. Production databases need hourly or continuous protection via snapshots. Application state typically requires daily full backups. Test restores weekly to validate recovery time objectives and ensure backup integrity matches business continuity plans.

Velero supports AWS S3, Google Cloud Storage, Azure Blob, MinIO, Ceph RADOS, and any S3-compatible object store. Configure credentials via Kubernetes secrets and define BackupStorageLocation resources specifying bucket, region, and endpoint for each supported backend.

Yes, Velero is Apache 2.0 licensed and completely free. Costs arise only from object storage consumption and API calls to your cloud provider. Enterprise support is available through VMware Tanzu but community version handles most production workloads without licensing fees.

Etcd snapshots capture only cluster state, not persistent volume data or custom resources outside etcd. Velero provides application-consistent backups including PVs, ConfigMaps, Secrets, and CRDs, enabling complete workload restoration rather than partial cluster recovery after failures.

Check pod logs with kubectl logs -n velero deployment/velero. Common causes include misconfigured storage credentials, insufficient IAM permissions, network policies blocking egress, or volume snapshot controller failures. Validate BackupStorageLocation phase shows Available before troubleshooting further.

Yes. Enable server-side encryption on your object storage bucket or configure client-side encryption using Velero plugins. Store encryption keys securely in HashiCorp Vault or cloud KMS. Never commit unencrypted credentials to Git repositories or embed them directly in manifests.

Restore to an isolated namespace first using --namespace-mappings flag. Validate pod health, PVC binding, and data integrity before promoting to production. Document restore duration and failure points to refine runbooks and improve actual disaster recovery confidence.

No, Velero performs full metadata backups each run. However, underlying CSI snapshots may be incremental depending on storage provider. Object storage deduplication reduces redundant data transfer. Monitor storage growth and implement lifecycle policies to manage long-term retention costs effectively.

Minimal IAM policy requires s3:PutObject, s3:GetObject, s3:ListBucket, s3:DeleteObject for backup bucket access plus ec2:CreateSnapshot, ec2:DeleteSnapshot, ec2:DescribeSnapshots for EBS volumes. Avoid wildcard permissions. Use IRSA with service account annotation for secure credential management in EKS clusters.

No, Velero only protects in-cluster resources. External databases require separate backup solutions like pg_dump, mysqldump, or vendor-specific tools. Coordinate external backup timing with Velero schedules to achieve consistent application state across distributed systems during recovery.

Review release notes for breaking changes between versions. Upgrade CRDs first using velero install --crds-only, then update Helm chart or CLI binary. Existing backups remain accessible if storage location configuration stays unchanged. Always test restore compatibility after major version upgrades.