Skip to content
IT glossary
DevOps and cloudUpdated December 3, 2026

etcd

etcd is a distributed key-value store for shared configuration and system state. It keeps copies on multiple servers so it can keep working when some of them fail.

What etcd stores

Think of etcd as a shared dictionary for infrastructure. A key such as /config/worker/max-jobs can hold a setting that several workers need to agree on. A worker can read the current value and subscribe to changes instead of polling for updates. This makes etcd useful for configuration and coordination, not for storing application logs, large files, or customer records that need rich queries.

How the cluster agrees on changes

etcd uses the Raft consensus algorithm. Members elect a leader, which replicates log entries to other members. Committing a new write requires a quorum: a majority of voting members. A three-member cluster needs two votes; a five-member cluster needs three. If a leader fails, the remaining majority can elect a replacement. If a network split leaves no side with a majority, neither side can commit new writes. This prevents two sides from independently accepting conflicting updates.

Key reads are linearizable by default: a read that starts after a write completes cannot return an older value. Clients can opt for a local read that may be stale. Each change to the keyspace advances its revision, and clients can use those revisions to resume a watch after disconnecting. A watch is not a permanent event log: if compaction has removed the history a client needs, it must read the current state and start watching from the following revision.

Try it with etcdctl

On a test instance, store a setting and start a watch:

etcdctl put /config/worker/max-jobs 8
etcdctl get /config/worker/max-jobs
etcdctl watch /config/worker/max-jobs

Run etcdctl put /config/worker/max-jobs 12 in another terminal to see the update on the watch. For competing writers, a conditional transaction can compare a key's modification revision with the one the client previously read and update the key only if they match.

Where you'll encounter it

In Kubernetes, the API server persists objects such as Deployments, ConfigMaps, and Secrets in etcd. Controllers and operators normally work through the Kubernetes API rather than talking directly to etcd. An etcd snapshot can help recover cluster state, but it does not back up data inside application volumes. Replication does not replace snapshots either: an accidental deletion is replicated just like any other valid change.

What interviewers ask

A common question is whether adding a fourth voting member to a three-member cluster improves fault tolerance. It doesn't: the quorum rises from two to three, so both clusters can tolerate only one member failure. Another question is what happens to Kubernetes when etcd loses quorum. Existing containers don't stop just because quorum is lost, but the control plane cannot persist changes such as newly created Pods.