Highly available control plane concepts
Describe stacked vs external etcd topologies and their trade-offs.
By Invicly Tech, , in Kubernetes Administrator (CKA). About 8 minutes to read.
In short
A highly available control plane runs several API servers behind a load balancer and an etcd cluster with an odd number of members. etcd can be stacked on the control plane nodes or run on separate hosts. etcd needs a majority, or quorum, to accept writes.
Explained simply
A cluster with one control plane node has a single point of failure. If that machine dies, nothing new can be scheduled, scaled or repaired. High availability (HA) means running the control plane on several machines so one failure does not stop the cluster.
It is like a company with three managers instead of one. If one is sick, the other two keep making decisions. But decisions need a majority vote, so with only two managers a single absence would freeze everything. That is why HA setups use odd numbers like three or five.
Two parts need care. The API servers are stateless, so you simply run several and put a load balancer in front. etcd holds the data and must agree on every write, so its size and placement decide how many failures you can survive.
Press Play on a diagram to walk through it one step at a time.
- etcd on each control plane node
- Fewer machines to run
- kubeadm default for HA
- Losing a node loses etcd and API
- etcd on dedicated hosts
- Failures are decoupled
- More hosts to manage
- Better isolation for large clusters
- 1Clients and kubelets
Use the shared control plane endpoint.
- 2Load balancer
Spreads TCP 6443 across API servers.
- 3API servers x3
Stateless; any can serve any request.
- 4Scheduler and controllers
One active leader each, chosen by leader election.
- 5etcd cluster x3
Raft consensus; tolerates one member failure.
- Quorum: 2
- Survives 1 failure
- Common default
- Lowest cost for HA
- Quorum: 3
- Survives 1 failure
- More cost, no extra safety
- Avoid even sizes
- Quorum: 3
- Survives 2 failures
- For critical clusters
- Slightly slower writes
- API server to etcd leader: Put /registry/pods/web1Put /registry/pods/web
- etcd leader to Follower A: Append entry2Append entry
- etcd leader to Follower B: Append entry3Append entry
- Follower A to etcd leader: Saved (majority reached)4Saved (majority reached)
- etcd leader to API server: Committed5Committed
- Follower B to etcd leader: Saved (late, still fine)6Saved (late, still fine)
In depth
How etcd agrees on writes
etcd uses the Raft consensus algorithm. One member is the leader and every write goes through it. The leader sends the write to the followers, and the write is committed only when a majority, called the quorum, has saved it. Quorum is floor(n/2) + 1.
If the leader fails, the remaining members hold an election and pick a new leader within seconds, as long as a majority is still alive. If quorum is lost, etcd stops accepting writes to stay consistent, and the API server cannot change anything. Running Pods keep running, but the cluster is frozen.
- 3 members: quorum 2, tolerates 1 failure
- 5 members: quorum 3, tolerates 2 failures
- 4 members: quorum 3, still tolerates only 1
The shared endpoint
Every kubelet, every kubeconfig and the certificates themselves point at one API address. In HA that address must be a load balancer or a virtual IP in front of all API servers, set at install time with kubeadm init --control-plane-endpoint. Choosing a DNS name rather than a raw IP makes later changes easier.
Adding this endpoint later is painful, because certificates must include it. So even a one-node lab that might grow should be initialised with a control-plane-endpoint.
Joining more control plane nodes
kubeadm init --upload-certs stores the control plane certificates, encrypted, in a Secret in kube-system. It prints a certificate key. Other nodes then run kubeadm join with --control-plane and --certificate-key, download the certificates, and start their own API server, scheduler, controller manager and, in a stacked setup, a new etcd member.
The uploaded certificates are deleted after two hours for safety. To add another control plane later, run kubeadm init phase upload-certs --upload-certs to get a fresh key.
- First control plane to Secret in kube-system: init --upload-certs: encrypted certs, key printed1init --upload-certs: encrypted certs, key printed
- New node to Secret in kube-system: join --control-plane --certificate-key2join --control-plane --certificate-key
- Secret in kube-system to New node: Certificates downloaded3Certificates downloaded
- New node to etcd cluster: Add etcd member (stacked setup)4Add etcd member (stacked setup)
- etcd cluster to New node: Member joined5Member joined
Choosing stacked or external
Stacked etcd runs on the control plane nodes themselves. It needs fewer machines and is the kubeadm default. External etcd runs on its own hosts, so losing a control plane node does not also remove an etcd member, and etcd load does not compete with the API server.
Most teams start stacked with three nodes and move to external etcd only for large or very critical clusters.
Learn it in 3 short steps
About 40m each. Track them with a timer in your plan.
- 1Compare stacked and external etcd~40m
- 2Explain load balancing the API servers~40m
- 3Discuss quorum and failure tolerance~40m
Key points
- Quorum is a majority: 3 members tolerate 1 failure, 5 tolerate 2.
- Even member counts add cost without adding failure tolerance.
- kubeadm init --control-plane-endpoint sets the shared load balancer address.
- Scheduler and controller manager use leader election, so only one is active.
Key terms
Tap a card to flip it. 0/5 known
Examples
Building a three-node stacked control plane
Step 1: create a load balancer or DNS name k8s-api.lab:6443 pointing at all three nodes. Step 2: init the first node with that endpoint and --upload-certs. Step 3: run the printed control plane join command on nodes two and three. Step 4: check that three etcd and three API server Pods are Running.
sudo kubeadm init --control-plane-endpoint "k8s-api.lab:6443" \
--upload-certs --pod-network-cidr=192.168.0.0/16
# on cp2 and cp3:
sudo kubeadm join k8s-api.lab:6443 --token <t> \
--discovery-token-ca-cert-hash sha256:<h> \
--control-plane --certificate-key <key>
kubectl -n kube-system get pods -l component=etcd -o wideReasoning about a failure
A stacked cluster has three control plane nodes and two of them lose power. Step 1: only one of three etcd members is alive, below the quorum of two. Step 2: etcd refuses writes, so kubectl create and scale fail or hang. Step 3: running Pods keep serving traffic. Step 4: bringing back one more node restores quorum and the cluster recovers by itself.
Quick reference
- Quorum = floor(n/2) + 1; tolerated failures = n - quorum
- Use 3 or 5 etcd members; even numbers add cost, not safety
- kubeadm init --control-plane-endpoint LB:6443 --upload-certs
- kubeadm join ... --control-plane --certificate-key KEY
- Uploaded certs expire after 2 hours: kubeadm init phase upload-certs --upload-certs
- Scheduler and controller manager are active-passive via Leases
Common mistakes
- Running two etcd members, which tolerates zero failures.
- Pointing kubelets at one API server instead of the load balancer.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Fill in the table: for 1, 3, 5 and 7 etcd members, what is the quorum and how many failures are tolerated?
- Exercise 2medium
On a stacked HA cluster, list the etcd members using etcdctl from one control plane node.
- Exercise 3hard
Your three-node HA cluster's uploaded certificates expired and you need to add a fourth control plane node. Get a working join command.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Do I need HA for the CKA exam?
- You will not usually build one, but you must explain stacked vs external etcd, quorum, and how the load balancer fits in.
- Can etcd members be in different data centres?
- Yes, but every write waits for a majority, so high latency between sites slows the whole cluster. Keep members within low-latency links, such as zones in one region.
- What load balancer should I use for the API servers?
- Any TCP load balancer works: a cloud load balancer, HAProxy with keepalived, or kube-vip. It only needs to forward port 6443 to healthy API servers.