I'm comparing snapshots, backup tools, and application-level backups for persistent volumes. How do you handle databases differently from ordinary file volumes, and what does a useful restore drill look like?
How do you back up Kubernetes volumes, and do you actually test restores?
Answers
I'd separate databases from ordinary files. For Postgres, use a database-aware backup and WAL archiving if you need point-in-time recovery. CloudNativePG with its Barman plugin or pgBackRest are options. MongoDB has its own dump and oplog-based approaches.
A snapshot of a running database volume may only be crash consistent. That can be useful, but don't assume it gives you an application-consistent backup. Check the database and storage documentation, and test recovery rather than finding out during an outage.
Reply to this answer
For file volumes, start with what your storage provider supports. A CSI snapshot or a storage system's native backup may be convenient, while a file-level copy to object storage gives you another route to restore data.
Velero can back up Kubernetes resources and work with volume backup methods. Restic is another option for copying files. Check exactly where the data ends up and whether the backup survives losing the original storage system.
Reply to this answer
Time a real restore, not just the backup job. Create a separate test environment, restore the resources and volume data, then start the workload and check that the application can actually use the data. For a database, include recovery and some meaningful data checks, not just a successful pod start.
Transfer time alone can be a nasty surprise. At a sustained 1 gigabit per second, pulling 15 TB would take roughly 33 hours in ideal conditions, before recovery and validation. Actual throughput and restore overhead will change that. Compare the measured time with your recovery time objective and automate drills on a schedule if you can.
_w93~mivquelo.4:
That makes sense. The backup completing doesn't tell me how long it takes to get the service running again.
Reply to this answer
Don't forget the backup destination and its credentials. If the same access can modify production data and delete every backup, one compromised account can take out both. Restrict backup access and consider retention protections that prevent deletion or modification.
Reply to this answer
There's also a deployment choice here. Some people would keep databases outside Kubernetes on a VM, dedicated server, or managed service, with their own backup tooling. That changes the operational setup, but you still need to test database recovery.
Reply to this answer
Add your answer
Answers are reviewed before publication.
3z~gobletspanner_681:
A replica can help with failover, but it isn't a replacement for a backup. You still need a way to recover from data loss or corruption.