Happy Dussehra! May good always win. Merry Christmas! Warm wishes from Vizag. Happy New Year! Here’s to a great year ahead.

DevOps · CNCF daily

etcd: The Distributed Key-Value Store Behind Kubernetes

CNCF Graduated. A strongly consistent, Raft-based key-value store with watch and lease primitives, used as the control plane database of Kubernetes and as a coordination service for distributed systems.

8 min read

CNCF Graduated

  • etcd
  • Raft
  • Kubernetes
  • gRPC
  • bbolt
CNCF project page

etcd is a distributed, strongly consistent key-value store. It keeps small amounts of critical data, such as cluster state, configuration and locks, replicated across several members using the Raft consensus algorithm, and exposes it through a gRPC API with watches, leases and transactions. It addresses the problem of coordination: distributed systems need one reliable place to agree on who the leader is, what the configuration is and which members are alive. etcd began at CoreOS in 2013, joined the CNCF as an incubating project in December 2018 and graduated on November 24, 2020. It is best known as the datastore behind every standard Kubernetes control plane. The 3.7 line was announced on July 8, 2026.

CNCF daily · Sprint 2, day 4 · Coordination & Service Discovery

At a glance

Category Orchestration & Management › Coordination & Service Discovery
CNCF status Graduated. Incubating December 2018; graduated November 24, 2020
Written in Go
License Apache 2.0
Current release lines 3.7 (July 8, 2026), 3.6 (May 15, 2025) and 3.5, which is supported until July 2027
Consensus and storage Raft for replication; bbolt for the on-disk, multi-version key-value store
API gRPC with range, put, delete, transactions, watches, leases, locks and elections

Architecture

etcd architecture: clients send writes to the Raft leader, which replicates the log to two followers; every member persists the write-ahead log and applies entries to its bbolt MVCC store; clients can read from any member with serializable reads; etcdctl snapshot save writes backups to object storage.

Blue is the client, purple the etcd members, teal the storage. Followers do not forward writes; clients or an internal proxy send writes to the leader. Watches and leases are served from the MVCC store and are not drawn. Open the zoomable diagram, or download it as SVG or PNG.

Component Responsibility
Clients kube-apiserver, etcdctl and applications, speaking gRPC over TLS.
Leader The Raft member that accepts writes, appends them to its log and replicates them to the followers. A write is acknowledged once a majority of members has persisted it.
Followers Raft members that persist the leader’s log and apply it. They serve serializable reads from local state and take over if the leader fails.
Write-ahead log Every member persists each Raft entry to disk before it is applied, so a member recovers its state after a restart.
MVCC store (bbolt) Keeps revisions of every key, which allows consistent reads, watches from a revision and compaction of old versions; also backs leases, time-bound keys used for leader election, locks and liveness.
Snapshots etcdctl snapshot save writes a point-in-time backup from a running member; etcdutl restores it into a data directory and also handles defragmentation.

Design principle. etcd prefers correctness over throughput. A write succeeds only after a majority of members have persisted it, so the cluster tolerates the loss of a minority of members without losing acknowledged data, at the price of write latency set by disk and network round trips between members.

A write, its replication and a read

etcd flow in eight steps: a client writes to the leader, the leader replicates to both followers, each member persists the entry to its write-ahead log and bbolt store, a client reads from a follower, and a snapshot is saved to object storage.

  1. Write. A client sends a write to the leader over gRPC and TLS.
  2. Replicate to follower 1. The leader appends the entry to its log and sends it to the first follower.
  3. Replicate to follower 2. It sends the same entry to the second follower.
  4. Leader persists. The leader writes the entry to its write-ahead log and, once a majority has persisted it, applies it to its bbolt store.
  5. Follower 1 persists. The first follower writes to its own log and store.
  6. Follower 2 persists. The second follower does the same.
  7. Read. A client can read from any member with a serializable read, which may be slightly behind; the default linearizable read is confirmed through the leader.
  8. Back up. An operator saves a snapshot to object storage on a schedule.

With three members, a write needs two to persist it, so one member can fail without losing acknowledged data.

Open the zoomable flow diagram, or download it as SVG or PNG.

Production reference design

A typical Kubernetes platform on-premises or on cloud virtual machines runs three etcd members, or five for stricter availability, on dedicated SSD-backed nodes, either stacked on the control plane nodes (the kubeadm default) or as an external cluster.

  1. Size the cluster for failure tolerance. Three members tolerate one failure and five tolerate two. Use an odd count and spread members across zones that have low latency between them; adding members does not increase write throughput.
  2. Give etcd fast, dedicated disks. Use local or provisioned-IOPS SSD storage, because fsync latency on the write-ahead log is the main performance factor. Do not share the volume with noisy workloads.
  3. Configure TLS for clients and peers and bound the database size, for example in the etcd configuration file:
    name: etcd-1
    data-dir: /var/lib/etcd
    listen-client-urls: https://10.0.1.11:2379
    advertise-client-urls: https://10.0.1.11:2379
    listen-peer-urls: https://10.0.1.11:2380
    initial-advertise-peer-urls: https://10.0.1.11:2380
    initial-cluster: etcd-1=https://10.0.1.11:2380,etcd-2=https://10.0.2.12:2380,etcd-3=https://10.0.3.13:2380
    initial-cluster-state: new
    initial-cluster-token: prod-k8s
    quota-backend-bytes: 8589934592
    auto-compaction-mode: periodic
    auto-compaction-retention: "1h"
    client-transport-security:
      cert-file: /etc/etcd/pki/server.crt
      key-file: /etc/etcd/pki/server.key
      client-cert-auth: true
      trusted-ca-file: /etc/etcd/pki/ca.crt
    peer-transport-security:
      cert-file: /etc/etcd/pki/peer.crt
      key-file: /etc/etcd/pki/peer.key
      client-cert-auth: true
      trusted-ca-file: /etc/etcd/pki/ca.crt
  4. Back up on a schedule with a snapshot and copy it off the cluster:
    ETCDCTL_API=3 etcdctl --endpoints=https://10.0.1.11:2379 \
      --cacert=/etc/etcd/pki/ca.crt --cert=/etc/etcd/pki/client.crt --key=/etc/etcd/pki/client.key \
      snapshot save /backup/etcd-$(date +%F-%H%M).db
    etcdutl snapshot status /backup/etcd-2026-10-16-0600.db -w table
  5. Monitor with the built-in Prometheus metrics: leader changes, WAL fsync and backend commit duration, database size against quota, and proposal failures, and alert on them.
  6. Rehearse restore. Restore into a fresh data directory with etcdutl snapshot restore, and practise member replacement, because these are the procedures needed in an incident.

Typical uses are the Kubernetes control plane datastore, service discovery and configuration for other distributed systems (CoreDNS and Rook use it, among others), leader election and distributed locks.

Operational considerations

  • Scaling: etcd scales vertically and by limiting what is stored. The recommended data size is a few gigabytes; keep large objects, high-churn data and events out of it, and consider a separate etcd cluster for Kubernetes events on very large clusters.
  • High availability: keep a quorum healthy at all times; replace failed members promptly with etcdctl member commands, upgrade one member at a time, and never run two members on the same failure domain.
  • Security: require mutual TLS on client and peer ports, restrict network access to the client port to the API servers, encrypt Kubernetes Secrets at rest in the API server, and protect snapshots because they contain every Secret.
  • Cost and sizing: disk latency and network latency between members drive performance more than CPU. Provision for low fsync latency, and expect higher cost for multi-zone replication traffic in the cloud.
  • Common pitfalls: the database reaching its quota (etcd then rejects writes until compaction and defragmentation), forgetting compaction and defragmentation, slow disks causing leader elections, and upgrading across minor versions without following the guide. Version 3.6 requires first upgrading to 3.5.20 or later, and 3.7 removes the deprecated --experimental-* flags, so read the release notes before each minor upgrade.

Adoption

The CNCF graduation announcement named Alibaba, Amazon, Baidu, Cisco, EMC, Google, Huawei, IBM, Red Hat, Uber and Verizon among organisations using etcd, and projects including Kubernetes, CoreDNS, M3, Rook and TiKV as building on it. It reported 200 distinct contributors over the prior twelve months, a Trail of Bits security audit in July 2020 that found no significant issues in the core components, and Jepsen consistency testing in January 2020. Managed Kubernetes services from the major clouds run etcd on behalf of their customers.

Alternatives

Solution Model Best suited to
Apache ZooKeeper Mature coordination service using ZAB Existing ZooKeeper-based systems such as older Kafka and Hadoop stacks
HashiCorp Consul (NON CNCF) Service discovery with a key-value store, Raft-based Service discovery and mesh with a built-in UI
Kine with an SQL database etcd API on top of PostgreSQL, MySQL or SQLite Small Kubernetes distributions, as used by K3s
Managed control planes (EKS, GKE, AKS) Provider-run etcd Teams that prefer not to operate etcd
Kafka KRaft and cloud databases Built-in or managed metadata stores Systems that embed their own consensus layer

Strengths and limitations

Strengths Limitations
Strong consistency with a well-tested Raft implementation Small data limits; not a general database
Watches and leases suit controllers and leader election Write throughput does not grow by adding members
Graduated, vendor-neutral and used by Kubernetes everywhere Sensitive to disk and network latency
Simple gRPC API and clear operational tooling Needs scheduled compaction, defragmentation and tested backups
Downgrade support and feature gates since 3.6 Minor upgrades carry migration steps and removed flags

Recommendation

Adopt etcd as the datastore for self-managed Kubernetes and for coordination needs that require strong consistency. Run three or five members on dedicated SSD nodes with mutual TLS, scheduled compaction and tested snapshot restores, and plan minor upgrades one version at a time, noting that 3.5 remains supported until July 2027. Teams on managed Kubernetes do not operate etcd directly and need not run their own.

References: CNCF project page · etcd documentation · CNCF: etcd graduation announcement · Announcing etcd v3.7.0 · Announcing etcd v3.6.0 · endoflife.date: etcd

Spotted something wrong or out of date?Suggest a correction. I review every suggestion before changing the page.

EmailRSS