You build a three-master Kubernetes cluster with kubeadm because the docs say to. You set kubeadm init --control-plane-endpoint cluster.example.com:6443 — and then realize the docs assume you already have something handing out that endpoint IP. On a managed cloud, it’s a TCP load balancer with a health check. On bare metal in your office or a rented colo cabinet, it’s nothing — until you build it. The reflex is to put HAProxy + keepalived in front of the API servers, and that works fine, but it’s two more boxes (or two more services to argue with). kube-vip collapses both jobs into a single static pod that runs on every control-plane node, elects a leader through the Kubernetes API itself, and floats a VIP on the control-plane subnet. Total install is one YAML manifest per node, and once it’s bootstrapped, the cluster owns its own endpoint.
What’s happening
A multi-master kubeadm cluster needs every node (control-plane and worker) and every kubectl to reach the API server through a single stable endpoint. If you point them at one of the master IPs directly and that node dies, every kubelet, every operator, and every pipeline starts failing — even though the other two API servers are healthy. The classic fix is a TCP load balancer in front of the three API servers, with a health check on :6443. kube-vip implements that as a self-hosted layer: each control-plane node runs a kube-vip static pod (defined in /etc/kubernetes/manifests/), the pods talk to each other through a leader election (in ARP mode it uses the Kubernetes API itself as the lock, via a Lease object), and the elected leader binds the VIP to its primary interface and replies to ARP. When the leader dies, its lease expires within a few seconds and another node takes over via gratuitous ARP. The same kube-vip binary can also run BGP mode (advertising the VIP to an upstream router instead of using ARP) and can additionally play the role of MetalLB for Service-type LoadBalancer IPs — but those are separate concerns; here we only use it for the control-plane VIP in ARP mode, which is the cleanest deployment on a single-L2 cluster. The setup order matters: kube-vip must produce the VIP before kubeadm init can register the control plane against it, which means the very first manifest is laid down by hand before the cluster exists.
How to verify
The VIP should answer kubectl:
kubectl --server=https://10.10.0.50:6443 get nodes
# NAME STATUS ROLES AGE VERSION
# master01 Ready control-plane 1h v1.30.2
# master02 Ready control-plane 58m v1.30.2
# master03 Ready control-plane 57m v1.30.2
The VIP should live on exactly one master node at a time:
# Run on each master
ip -4 addr show | grep -F "10.10.0.50/32"
# Only one of three should print: inet 10.10.0.50/32 scope global ...
The static pod manifest should be present on every master:
ls /etc/kubernetes/manifests/kube-vip.yaml
kubectl -n kube-system get pods -l name=kube-vip -o wide
# NAME READY STATUS NODE
# kube-vip-master01 1/1 Running master01
# kube-vip-master02 1/1 Running master02
# kube-vip-master03 1/1 Running master03
If you kill the master currently holding the VIP, another master should pick it up within 5-10 seconds:
# On the leader node
sudo systemctl stop kubelet
# From a workstation
watch -n1 'kubectl --server=https://10.10.0.50:6443 get nodes'
The API call should fail for a few seconds and then succeed again, served by a different master.
The fix
The installer is two scripts. The first runs on the bootstrap master (the very first master) and lays down the kube-vip static pod before kubeadm init. The second runs on the joining masters.
#!/usr/bin/env bash
set -euo pipefail
### kube-vip control-plane VIP bootstrap installer
### Run on the FIRST control-plane node before `kubeadm init`.
### Requirements: containerd already installed and started, kubeadm/kubelet/kubectl 1.30+ already installed.
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT FOR YOUR ENVIRONMENT ===
VIP="10.10.0.50"
VIP_INTERFACE="ens18" # the interface on which the VIP should float
KUBE_VIP_VERSION="v0.8.5"
K8S_VERSION="1.30.4"
POD_CIDR="10.244.0.0/16"
SVC_CIDR="10.96.0.0/12"
NODE_NAME=$(hostname -s)
# =================================
echo
echo "========================================"
echo "kube-vip bootstrap on ${NODE_NAME}"
echo "VIP ${VIP} on ${VIP_INTERFACE}"
echo "========================================"
echo
if ! command -v kubeadm >/dev/null 2>&1; then
echo "kubeadm not found. Install Kubernetes ${K8S_VERSION} first."
exit 1
fi
echo "==> Pre-pulling images (so kubeadm init doesn't stall)"
kubeadm config images pull --kubernetes-version "v${K8S_VERSION}"
echo "==> Pulling kube-vip image"
ctr -n k8s.io image pull "ghcr.io/kube-vip/kube-vip:${KUBE_VIP_VERSION}"
echo "==> Generating kube-vip static pod manifest (ARP, controlplane mode)"
mkdir -p /etc/kubernetes/manifests
ctr -n k8s.io run --rm --net-host \
"ghcr.io/kube-vip/kube-vip:${KUBE_VIP_VERSION}" \
kube-vip-manifest-gen \
/kube-vip manifest pod \
--interface "${VIP_INTERFACE}" \
--address "${VIP}" \
--controlplane \
--arp \
--leaderElection \
--taint > /etc/kubernetes/manifests/kube-vip.yaml
# Note: depending on the kube-vip image tag, `ctr run` style may differ.
# An equivalent shell-out via crictl works too:
# crictl pull ghcr.io/kube-vip/kube-vip:${KUBE_VIP_VERSION}
# Or generate with a simple docker run on a workstation and scp the YAML.
echo "==> Checking the generated manifest"
test -s /etc/kubernetes/manifests/kube-vip.yaml
grep -q "${VIP}" /etc/kubernetes/manifests/kube-vip.yaml
grep -q "${VIP_INTERFACE}" /etc/kubernetes/manifests/kube-vip.yaml
echo "==> Writing kubeadm config"
cat > /root/kubeadm-config.yaml <<EOF
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
kubernetesVersion: "v${K8S_VERSION}"
controlPlaneEndpoint: "${VIP}:6443"
networking:
podSubnet: "${POD_CIDR}"
serviceSubnet: "${SVC_CIDR}"
apiServer:
certSANs:
- "${VIP}"
- "$(hostname -f)"
- "$(hostname -s)"
- "127.0.0.1"
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
localAPIEndpoint:
bindPort: 6443
nodeRegistration:
criSocket: "unix:///run/containerd/containerd.sock"
EOF
echo "==> Initialising the control plane"
kubeadm init --config /root/kubeadm-config.yaml --upload-certs
echo "==> Wiring kubectl for root"
mkdir -p /root/.kube
cp -f /etc/kubernetes/admin.conf /root/.kube/config
echo
echo "========================================"
echo "BOOTSTRAP DONE"
echo "========================================"
echo
echo "Cluster endpoint: https://${VIP}:6443"
echo
echo "Verify VIP is bound:"
ip -4 addr show "${VIP_INTERFACE}" | grep -F "${VIP}/" || true
echo
echo "Verify kube-vip pod is running:"
kubectl get pods -n kube-system -l name=kube-vip
echo
echo "Save the join commands kubeadm printed above for the other masters and workers."
On the other two masters, after they’ve joined with the kubeadm join command from the bootstrap output, drop the same static pod manifest:
#!/usr/bin/env bash
set -euo pipefail
### kube-vip joining-master installer
### Run AFTER `kubeadm join --control-plane` has succeeded on this node.
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT FOR YOUR ENVIRONMENT ===
VIP="10.10.0.50"
VIP_INTERFACE="ens18"
KUBE_VIP_VERSION="v0.8.5"
# =================================
echo "==> Pulling kube-vip image"
ctr -n k8s.io image pull "ghcr.io/kube-vip/kube-vip:${KUBE_VIP_VERSION}"
echo "==> Writing static pod manifest"
mkdir -p /etc/kubernetes/manifests
cat > /etc/kubernetes/manifests/kube-vip.yaml <<EOF
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-vip
namespace: kube-system
spec:
containers:
- name: kube-vip
image: ghcr.io/kube-vip/kube-vip:${KUBE_VIP_VERSION}
args:
- manager
env:
- name: vip_arp
value: "true"
- name: port
value: "6443"
- name: vip_cidr
value: "32"
- name: cp_enable
value: "true"
- name: cp_namespace
value: kube-system
- name: vip_ddns
value: "false"
- name: svc_enable
value: "false"
- name: vip_leaderelection
value: "true"
- name: vip_leasename
value: plndr-cp-lock
- name: vip_leaseduration
value: "5"
- name: vip_renewdeadline
value: "3"
- name: vip_retryperiod
value: "1"
- name: address
value: ${VIP}
- name: vip_interface
value: ${VIP_INTERFACE}
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
- SYS_TIME
volumeMounts:
- mountPath: /etc/kubernetes/admin.conf
name: kubeconfig
resources: {}
hostAliases:
- hostnames:
- kubernetes
ip: 127.0.0.1
hostNetwork: true
volumes:
- hostPath:
path: /etc/kubernetes/admin.conf
name: kubeconfig
status: {}
EOF
echo "==> Waiting for kubelet to schedule the static pod"
for i in {1..30}; do
if crictl ps --name kube-vip --state Running -q | grep -q .; then break; fi
sleep 2
done
echo
echo "kube-vip pod state on this node:"
crictl ps --name kube-vip
echo
echo "If this node now holds the VIP:"
ip -4 addr show "${VIP_INTERFACE}" | grep -F "${VIP}/" || echo "(VIP held elsewhere — that is fine.)"
A handful of operational notes you’ll want before this protects production traffic. The lease timings (vip_leaseduration=5, vip_renewdeadline=3, vip_retryperiod=1) give roughly 4-7 seconds of failover at the cost of being slightly chatty against the Kubernetes API — those are the values we use in production. Don’t go below 3 seconds; under load the API server can occasionally take longer than that to respond to a lease renewal, and a flapping VIP is worse than a slow one. The --taint flag on the bootstrap manifest gen ensures the VIP only ever runs on control-plane nodes (it adds a node selector for node-role.kubernetes.io/control-plane); without it, if you ever schedule a worker as a control plane, it would compete for the lease. ARP mode requires every master to be on the same L2 segment as the VIP — if your masters are split across racks/L3 boundaries, you need BGP mode (separate article). Finally, never put a third-party TCP load balancer in front of the VIP and then have kube-vip ALSO claim it — you’ll get an ARP/MAC flap that takes the cluster down hard.
A self-hosted Kubernetes control plane on bare metal is a real operational commitment. Our Cloud Compute team builds and runs kubeadm and k3s clusters under Managed Cloud Ops with control-plane HA, etcd backups, and patching cycles in place — start a scoping call if you’d like us to take that off your plate.