How do you stop and start a workload for the night without deleting it?
BeginnerScenarioUpgrades, etcd, disaster recovery and incidents
Answer
Situation read → A dev environment costs money overnight.
What I'd do →
kubectl scale deploy --all --replicas=0 -n dev- Record the original counts first (
kubectl get deploy -n dev -o custom-columns=NAME:.metadata.name,REPLICAS:.spec.replicas) - Scale back up in the morning
- Automate with a CronJob and a scoped ServiceAccount, or KEDA cron scaler
- Keep PVCs, which are not deleted by scaling
Why → Scaling to zero keeps all objects and data while releasing compute.
Interview tip → Mention that GitOps will undo manual scaling unless paused.
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