Does a completed Velero restore prove the recovered data is correct?
0 reputation · 15 Mar 2021, 12:39 UTC
0 reputation · 15 Mar 2021, 12:39 UTC
Assume a Kubernetes 1.29+ cluster with a CSI-capable storage driver and Velero 1.13+ handling backup and restore. A restore can complete cleanly while revealing little about data correctness: Velero recreates API objects from its backup, an etcd snapshot reinstates the API server's stored state, but persistent volumes return only through volume snapshots or driver-specific tooling.
The gap is verification. Kubernetes and Velero report structural success — resources recreated, PVCs bound — but neither ships a built-in command that confirms application data matches the pre-backup state. Whether a snapshot was crash-consistent or application-consistent depends on the storage driver and any pre-freeze hooks, so an identical green restore status can hide in-flight writes that never reached the backup.
Scope matters too: a full cluster restore (etcd plus volumes) and a namespace-level restore recreate different resource sets, which changes what any validation pass must cover.
Three open questions before committing to a runbook:
A "Completed" status in Velero (v1.13+) indicates structural success, not data integrity. It confirms that the Kubernetes API objects were successfully recreated and that the CSI-capable storage driver successfully bound the Persistent Volume Claims (PVCs) to the restored volumes. It does not verify the actual contents of those volumes.
Velero operates primarily at the orchestration layer. While it ensures the PersistentVolumeClaim exists and is linked to a snapshot, it does not perform checksums or block-level validation of the data inside the volume. The correctness of the recovered data depends on the consistency model of the underlying storage snapshot:
fsfreeze or a database LOCK TABLES) ensured all data was flushed to disk. This is the only way to guarantee data correctness at the filesystem level.Because Velero cannot detect internal data corruption, verification must be shifted to the application and infrastructure layers. Use the following hierarchy for validation:
Bound state and pods have transitioned to Running.pg_checksums for PostgreSQL or mysqlcheck for MySQL).To automate this, utilize Velero Restore Hooks. These allow you to run a specific pod after the restore completes to execute validation scripts before the application is exposed to traffic.
# Example: Verify a restored database is accepting queries
kubectl exec -it <database-pod> -- psql -U user -d dbname -c "SELECT count(*) FROM critical_table;"
Required Diagnostic: To refine this recommendation, please specify if you are using filesystem-level snapshots (CSI) or Restic/Kopia for file-level backups, as the failure modes for data corruption differ between the two.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.