Best Practices for Backing Up Databases in Kubernetes
Asked by
seafloor-1km
We're transitioning to Kubernetes for our company's software platform and have noticed a lot of advantages, like teams being able to independently develop and deploy services. However, we're facing challenges managing backups for our databases, which are running as StatefulSets. We're evaluating Kasten K10 and Velero, but we're struggling with how to perform backups and, particularly, how to manage restores based on different points in time. It feels like we're up against a sort of paradox similar to the CAP theorem. Has anyone dealt with this issue, and how did you resolve it?
Answers
For our Postgres databases, we do point-in-time recovery using the Barman cloud plugin and the CNPG operator. It simplifies everything. Just make sure you have the plugin set up properly with a sidecar container.
Reply to this answer
The restore issue with microservices can be tricky because each database can have its own timeline. Have you thought about using database-native tools like pg_dump through CronJobs in combination with Velero?
Reply to this answer
It's generally not advisable to run databases in Kubernetes for production unless you're using an operator that manages them effectively, like CNPG for Postgres. This allows you to perform point-in-time recovery or full backups easily.
Reply to this answer
Don't forget about Volsync! It's particularly effective for data-only backups and restores, especially if you're implementing GitOps.
Reply to this answer
Database operators that come with built-in backup CRDs work great with Velero. The operator manages application-consistent snapshots while Velero handles orchestration, making point-in-time restores a lot cleaner. What database engines are you working with?
Reply to this answer
Velero has its limitations with StatefulSet databases since volume snapshots don't offer application awareness. You might need to implement pre-hooks for consistent database dumps. Kasten can handle this more smoothly. What specific databases are you using?
Reply to this answer
Using the appropriate database tools is key for backing up your databases efficiently.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions