etcd
etcd is the distributed, strongly consistent key-value store that holds all Kubernetes cluster state, including nodes, pods, Secrets, and ConfigMaps. It is the single source of truth for the control plane, so protecting and backing it up is critical.
What etcd stores
Every object you create through the API server is persisted in etcd. Controllers and the scheduler watch it for changes and reconcile actual state to the desired state recorded there. Lose etcd without a backup and you lose the cluster's configuration.
source of truth")] E -->|"watch events"| C["Controllers"] E -->|"watch events"| S["Scheduler"] classDef user fill:#475569,color:#ffffff classDef api fill:#326CE5,color:#ffffff classDef store fill:#FFEDD5,color:#1E293B classDef ctl fill:#D1FAE5,color:#1E293B class K user class A api class E store class C,S ctl
Why 3 or 5 members
etcd uses the Raft consensus protocol and needs a majority (quorum) of members to accept writes.
| Members | Quorum | Failures tolerated |
|---|---|---|
| 1 | 1 | 0 |
| 3 | 2 | 1 |
| 5 | 3 | 2 |
Use odd numbers. A fourth member adds no extra fault tolerance over three.
Health and backup
export ETCDCTL_API=3ETCD_FLAGS="--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 $ETCD_FLAGS endpoint healthetcdctl $ETCD_FLAGS member list -w table # Snapshot, then verify itetcdctl $ETCD_FLAGS snapshot save /backup/etcd-$(date +%Y%m%d-%H%M).dbetcdutl snapshot status /backup/etcd-20261013-0200.db -w tableCopy snapshots off the cluster, for example to an S3 bucket in ap-south-1, and rehearse a restore. Managed services such as EKS and GKE operate etcd for you.
Encryption at rest
Secrets are stored base64-encoded, not encrypted, unless you enable an EncryptionConfiguration on the API server (ideally with a KMS provider).
apiVersion: apiserver.config.k8s.io/v1kind: EncryptionConfigurationresources: - resources: ["secrets"] providers: - aescbc: keys: - name: key1 secret: <base64-encoded-32-byte-key> - identity: {}Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| etcdserver: no leader | Quorum lost or disk full | Restore members, check disk |
| Frequent leader changes | High latency between members | Fix network or disk latency |
| Slow API responses | Large DB or slow disk | Defragment, use fast SSDs |
SecurityAnyone with direct etcd access can read every Secret. Restrict access to control plane nodes and enable encryption at rest.
TipRun etcd on fast local SSDs. etcd is very sensitive to disk write latency.
Common MistakeTaking snapshots but never testing a restore. An untested backup is a guess.
Frequently Asked Questions
Why does Kubernetes use etcd and not a general database?
Kubernetes needs strongly consistent state and an efficient watch API so controllers react to changes immediately. etcd's Raft-based consensus gives both.
What happens if etcd loses quorum?
The API server cannot write, so you cannot create or change resources. Running pods usually keep running, but nothing can be rescheduled until quorum returns.
Should I run etcd inside the cluster it serves?
Control plane etcd typically runs as static pods on control plane nodes. Whatever the topology, keep backups outside the cluster.