A Highly Available Control Plane Needs a Virtual IP That No Single Node Owns

In progress Kubernetes Networking

Adding control-plane nodes doesn't make a cluster highly available if every kubelet and kubeconfig still points at the first node's IP. When that node dies, the API is unreachable even though two healthy API servers are running. The fix is a stable endpoint in front of them: on bare metal, a virtual IP (VIP) that moves to a healthy control-plane node, announced with ARP or BGP by a tool such as kube-vip or keepalived.

How the Virtual IP Works

  1. kubeadm init is run with --control-plane-endpoint set to the VIP (or a DNS name for it), so certificates and kubeconfigs use that address, not a node's.
  2. On each control-plane node, kube-vip runs (as a static pod) and elects a leader.
  3. The leader binds the VIP and announces it to the LAN; clients send API traffic there.
  4. If the leader fails, another node wins the election and announces the VIP; clients reconnect to the same address.

The Bootstrap Deadlock

kube-vip needs API access (and RBAC rules that only exist once the cluster is initialised) to run its leader election and bind the VIP. kubeadm init, meanwhile, needs the VIP to answer during initialisation. Each waits for the other. Since Kubernetes 1.29, the admin.conf that kubeadm generates no longer carries cluster-admin rights during bootstrap, which is what breaks the usual kube-vip static-pod setup.

Two ways out:

  • point kube-vip's manifest at super-admin.conf during the first kubeadm init, then switch it back to admin.conf;
  • or bind the VIP to the node's interface by hand before kubeadm init, and let kube-vip take it over once the cluster is up.

Either way the VIP starts imperatively and is then managed declaratively.

Clients Can Keep a Stale Address Mapping

After a failover, a machine that ignored or missed the new node's gratuitous ARP keeps sending to the old MAC address and sees no route to host. Flushing the entry (sudo arp -d <VIP> on macOS, ip neigh flush <VIP> on Linux) and pinging the VIP refreshes it.

References

Review cards

Flashcard Why aren't extra control-plane nodes enough for HA when the endpoint is the first node's IP?

Kubelets and kubeconfigs still point at that IP, so when the node dies the API is unreachable, even with healthy API servers left. A VIP moves to a healthy node, so the endpoint stays valid.

Flashcard How does kube-vip keep the API address working after a control-plane node fails?

kube-vip on each control-plane node takes part in a leader election. When the leader fails, another node wins, binds the VIP and announces it (ARP or BGP), and clients reconnect to the same address.

Quiz Why does a kube-vip static pod deadlock with the first `kubeadm init` on Kubernetes 1.29+?
  • kube-vip needs API access to bind the VIP, while kubeadm init needs the VIP to answer
  • kube-vip and kubeadm init must run on different nodes
  • kubeadm init rejects a control-plane endpoint that is a VIP
  • kube-vip can only announce the VIP with BGP during bootstrap

Each waits for the other: since 1.29 the generated admin.conf has no cluster-admin rights during bootstrap. Fix it by pointing kube-vip at super-admin.conf for the first init, or by binding the VIP by hand first.