What does etcd do?
etcd as the Kubernetes database: keys, leader election, Raft quorum, watches and backups.
Transcript
etcd is the database of Kubernetes: every object, from pods to secrets, is stored there.
It is a key-value store: each object lives under a key, built from its type, namespace and name.
Several etcd members form a cluster and elect a leader. Only the leader accepts writes.
A write is committed once a majority of members have it. This is the Raft algorithm.
That is why clusters run three or five members. With three, one can fail and the cluster still has a quorum.
Clients can watch a key, and etcd pushes every change. That is how the scheduler, controllers and kubelets react in real time.
Lose etcd without a backup, and you lose the cluster state. So take regular snapshots.
Store. Agree. Watch.
More in this series
1:30Inside Kubernetes
The control plane and the nodes: API server, etcd, scheduler, controllers and kubelet, and how a pod gets created.
1:09How the scheduler works
How kube-scheduler picks a node for a pod: filtering, scoring, binding, and how to influence it.
1:21Controllers and reconciliation
The control loop at the heart of Kubernetes: desired vs actual state, Deployments, ReplicaSets and the kubelet.