kubectl get ..., the apiserver reads that information from etcd. Changes to the cluster (creating a Pod, updating a ConfigMap, adding a Node) are only considered complete once the apiserver persists the change to etcd.

etcd is the single source of truth for Kubernetes cluster state. Plan for encryption, secure access, and regular backups — losing or corrupting etcd can render a cluster unrecoverable.
How Kubernetes uses etcd
- The kube-apiserver reads and writes cluster state to etcd (default client port 2379).
- All Kubernetes resources are stored under the
/registryroot key in etcd. - Writes must be acknowledged by etcd for operations to be considered complete. This makes etcd critical to cluster consistency.
Common deployment patterns
There are two common approaches for deploying etcd for a Kubernetes control plane:
Practice test environments for this course use kubeadm, but understanding both manual and kubeadm-managed deployments is important.
Deploying etcd from scratch (manual installation)
A manual installation typically involves:- Downloading an etcd release and extracting the binaries.
- Installing
etcdandetcdctlon control-plane nodes. - Creating TLS certificates for client and peer communication.
- Configuring a systemd unit to run etcd with appropriate flags (advertised URLs, data directory, initial cluster configuration, etc.).
- The
--advertise-client-urlsoption sets the endpoint the apiserver and other clients should use (default port 2379). - Peer communication between etcd members commonly uses port 2380.
- TLS is strongly recommended for both client and peer traffic; creating and deploying certificates is a necessary step.
Deploying etcd with kubeadm
When you initialize a cluster with kubeadm, it typically places an etcd pod manifest on the control-plane node so etcd runs as a static pod inkube-system. You can inspect the namespace to find the etcd Pod:
Exploring etcd data with etcdctl
To explore the etcd keyspace from a kubeadm-managed cluster, executeetcdctl inside the etcd Pod. Use -- after kubectl exec to pass the command into the container:
- If your
etcdctlrequires API selection or TLS settings, prependETCDCTL_API=3and add--endpoints,--cacert,--cert, and--keyflags as needed. - Kubernetes stores resources under
/registry. Example partial output:
High-availability etcd clusters
For production, run etcd as a clustered HA service across multiple control-plane nodes so the cluster can tolerate node failures. Key points:- Each etcd member must know about other members to form a quorum. This is typically configured with
--initial-cluster(or equivalent). - Peer URLs (default port 2380) are used for server-to-server communication. Client URLs (default port 2379) are used by the apiserver and other clients.
- Use secure TLS for both peer and client traffic, and require certificate authentication where possible.
--initial-cluster entry lists each member name with its peer URL so members can discover and join the cluster.
In production, ensure regular etcd backups, off-cluster snapshots, and a tested restore process. Loss of etcd data can result in permanent cluster data loss.
Key takeaways
- etcd is the canonical datastore for Kubernetes cluster state and must be secured and backed up.
- kubeadm typically runs etcd as a pod for ease of bootstrap; manual deployments give you full control.
- For HA, run multiple etcd members, configure peer URLs and certificates, and ensure quorum is maintained.
- Use
etcdctlcarefully to inspect keys (cluster data lives under/registry) and always use TLS/authentication in production.