How do you take backups and restore stateful workloads on Kubernetes?
AdvancedScenarioConfiguration, Secrets and storage
Answer
Situation read → The business needs RPO below 1 hour for a database on Kubernetes.
What I'd do →
- Use database-native backups (pg_dump, pgBackRest, WAL archiving to S3) as the primary method
- Use CSI VolumeSnapshots for crash-consistent snapshots with a
VolumeSnapshotClass - Use Velero for namespace-level backups of objects and PV snapshots
- Test restores regularly into a scratch cluster
- Store backups in a separate account and region
Why → Snapshots alone can be inconsistent for databases, and untested backups are not backups.
Interview tip → Mention an operator such as CloudNativePG which automates this.
More on Configuration, Secrets and storage
How do you inject configuration into pods and what are the options?BeginnerA ConfigMap was updated but the pod still shows old values. Why?IntermediateHow do you store a database password safely in Kubernetes?BeginnerHow do you manage secrets in GitOps without committing them in plain text?IntermediateA pod fails with `CreateContainerConfigError` and a missing key. What happened?BeginnerWhat is the difference between emptyDir, hostPath, PV/PVC and when do you use each?Beginner