Interview Prep/Kubernetes/Upgrades, etcd, disaster recovery and incidents

How do you back up etcd on a self-managed cluster?

BeginnerScenarioUpgrades, etcd, disaster recovery and incidents
Answer

Situation read → A kubeadm cluster has no backup.

What I'd do →

  1. ETCDCTL_API=3 etcdctl snapshot save /backup/etcd.db --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key
  2. Verify with etcdutl snapshot status /backup/etcd.db
  3. Copy offsite to S3
  4. Schedule with a CronJob or systemd timer
  5. Test restore regularly

Why → A snapshot captures all cluster state, and restoring is the only proof of a good backup.

Interview tip → Say on EKS you do not own etcd, use Velero or GitOps.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Upgrades, etcd, disaster recovery and incidents