Pcornel
Browse topics
Options
Recent
Favorites
Containers · Technical reference

etcd

Direct answer

etcd is the consistent key-value store holding all Kubernetes state, run as a Raft cluster (usually 3 or 5 members).

When to use this

Use it when the control plane is slow or unavailable, or for backup and restore.

First 30 seconds

1. etcdctl endpoint health --cluster (with certs).

2. etcdctl endpoint status -w table — leader, DB size.

3. Disk latency (wal_fsync metrics).

4. Snapshot: etcdctl snapshot save /backup/etcd.db.

5. Defragment when DB grows.

Operational verification

API server → etcd leader → Raft replication → committed

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Docker / containerd / Podman / Kubernetes / OCI-compatible platforms
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformDocker / containerd / Podman / Kubernetes / OCI-compatible platforms
Scope / prerequisiteUse it when the control plane is slow or unavailable, or for backup and restore.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 How to verify Verify boundary

Check that all members are healthy and one leader exists. Watch fsync and commit latency metrics. Restore a snapshot into a test cluster to show the backup works.

Step 2 Common failures Narrow the fault

An even member count adds no fault tolerance. Exceeding the database quota raises a NOSPACE alarm and blocks writes. Slow disks cause leader elections and API timeouts.

Key points

Quorum needs a majority of members. Back up with etcdctl snapshot save regularly. Slow disks (fsync latency) make the whole cluster slow.

Key checks
  • etcdctl endpoint health --cluster — first check for this topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl logs <pod> [-c <c>] [--previous] — container logs (incl. previous crash)
  • kubectl get events --sort-by=.lastTimestamp — recent cluster events
ReferenceWhat it is1 section · depth on demand

How it works

etcd uses the Raft protocol: one leader accepts writes and replicates them to followers; a write is committed when a majority stores it. Compaction and defragmentation keep the database size under its quota.

ReferenceImportant terms & boundaries3 sections · depth on demand

Operating etcd

ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=ca.crt --cert=server.crt --key=server.key endpoint health
etcdctl member list
etcdctl snapshot save /backup/etcd-$(date +%F).db
etcdctl defrag

Documented example, not captured output. Run 3 or 5 members on fast SSDs with low latency; back up snapshots regularly (they contain Secrets — encrypt them). The default space quota is 2 GB; exceeding it makes the cluster read-only (alarm NOSPACE).

In depth

etcd stores every Kubernetes object. It is a Raft cluster: a write is committed when a majority (quorum) of members has persisted it.

Fault tolerance by member count

MembersQuorumFailures tolerated
110
321
431
532

An even number adds cost and latency but no extra tolerance.

Backup and restore

etcdctl snapshot save /backup/etcd-$(date +%F).db      # with --endpoints, --cacert, --cert, --key
etcdutl snapshot status /backup/etcd-2026-11-27.db -w table
etcdutl snapshot restore /backup/etcd-2026-11-27.db --data-dir /var/lib/etcd-restore

A restore creates a new cluster from the snapshot; point the etcd static Pod (or service) at the new data directory on every member, and restore all members from the same snapshot.

Signals of an unhealthy cluster

SignalMeaning
etcd_server_leader_changes_seen_total risingLeader elections — usually slow disk or network
etcd_disk_wal_fsync_duration_seconds p99 > ~10 msDisk too slow for etcd
alarm:NOSPACEDatabase exceeded its quota; writes rejected

After clearing space: etcdctl compact <rev>, etcdctl defrag on each member, then etcdctl alarm disarm. Put etcd on SSDs and keep it away from noisy disks.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Common mistakes

  • etcd without backups.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
etcdetcd backup snapshotetcd quorum
Confirmation

Confirm action

Continue?