How would you perform a zero-downtime migration of a stateful database from a VM into Kubernetes?
AdvancedScenarioUpgrades, etcd, disaster recovery and incidents
Answer
Situation read → Move PostgreSQL to a CloudNativePG cluster.
What I'd do →
- Set up the operator and a replica cluster
- Configure logical or physical replication from the VM
- Verify lag and consistency
- Cut over during a short write freeze: promote and switch app connection strings
- Keep the VM as fallback until validated
Why → Replication allows a small controlled cutover window.
Interview tip → Say you rehearse and have a rollback plan.
More on Upgrades, etcd, disaster recovery and incidents
How do you back up etcd on a self-managed cluster?BeginnerHow do you restore a cluster from an etcd snapshot?Advancedetcd database space exceeded: `mvcc: database space exceeded`. What now?AdvancedWalk through a kubeadm minor version upgrade.AdvancedHow do you find deprecated or removed APIs before an upgrade?IntermediateA cluster upgrade broke an operator because its CRD API version was removed. How do you recover?Advanced