What is etcd and why does Kubernetes need it?
Short answer
etcd is a distributed key-value database that stores the entire state of a Kubernetes cluster — every Deployment, Pod, Service, Secret and ConfigMap. If etcd is lost without a backup, the cluster forgets everything.
Explained in simple words
etcd is the cluster's memory or record book. When you create a Deployment, the API server writes it into etcd. When the scheduler places a Pod, that decision is written into etcd. Everything Kubernetes "knows" lives there.
How it works
- Key-value store: data is saved as keys and values, for example key
/registry/deployments/default/webholds the Deploymentweb. - Distributed and consistent: it usually runs as 3 or 5 copies (members) on different machines. They use a voting system called Raft to agree on every change.
- Quorum: a majority of members must be healthy for etcd to accept writes. With 3 members you can lose 1; with 5 members you can lose 2. That's why you always use an odd number.
| etcd members | Can survive losing |
|---|---|
| 1 | 0 (no high availability) |
| 3 | 1 |
| 5 | 2 |
Example — take a backup (a very common interview and real-world task)
ETCDCTL_API=3 etcdctl snapshot save /backup/etcd-$(date +%F).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
ETCDCTL_API=3 etcdctl snapshot status /backup/etcd-2026-11-26.db --write-out=table
On EKS, AKS and GKE, the cloud provider manages and backs up etcd for you — you never see it.
What happens if etcd fails?
- Running containers keep running for a while, because the kubelet already knows what to run.
- But you can't create, update, scale or delete anything, and the cluster can't heal itself.
- If etcd data is lost without a backup, you have to rebuild the cluster and redeploy everything.
What to say in the interview
"etcd is a consistent, distributed key-value store where Kubernetes keeps all cluster state. Only the API server talks to it. It uses the Raft consensus protocol, so we run an odd number of members — usually three or five — and it needs a majority to accept writes. Backing up etcd regularly with etcdctl snapshot save is critical on self-managed clusters, because losing it means losing the cluster's desired state. On managed services like EKS, the provider handles it."
Follow-up questions you may get
- Why an odd number of members? Quorum needs a majority. Four members tolerate the same single failure as three, so the fourth adds cost without extra safety.
- How do you restore etcd?
etcdctl snapshot restoreinto a new data directory, then point the etcd static Pod at it. - Are Secrets encrypted in etcd? Only base64-encoded by default. You should enable encryption at rest (EncryptionConfiguration, or KMS on managed clusters).