Happy Dussehra! May good always win. Merry Christmas! Warm wishes from Vizag. Happy New Year! Here’s to a great year ahead.

DevOps · CNCF daily

kube-vip: A Virtual IP and Load Balancer for the Control Plane and Services on Bare Metal

CNCF Sandbox. A small Kubernetes component that keeps one address pointing at a healthy API server and gives LoadBalancer Services real addresses, announced by ARP or BGP, without a cloud load balancer.

19 min read

CNCF Sandbox

  • kube-vip
  • k3s
  • Kubernetes
  • BGP
  • MetalLB
CNCF project page

kube-vip provides a virtual IP address and a load balancer for Kubernetes clusters that do not run behind a cloud provider’s load balancer. It does two jobs with one component. For the control plane, it keeps one address attached to a working API server, so kubectl and every node can use a single endpoint while servers come and go. For Services of type LoadBalancer, it announces the address each Service has been given, so that traffic from the local network reaches the cluster. The project was created for small bare-metal and edge clusters, where running a separate HAProxy and keepalived pair, and a second tool for Services, adds more parts than the cluster itself. It was accepted into the CNCF Sandbox on June 26, 2021.

CNCF daily · Sprint 7, post 2 of 15 · Cloud Native Network

Nothing in this brief was installed or run. Commands and behaviour come from the project’s documentation, release page and issue list. The release page and the repository page were read as stored copies dated 23 September and 26 October 2026, so a release newer than v1.2.4 may exist; confirm on the releases page before installing.

At a glance

Category Runtime › Cloud Native Network (as placed in the CNCF Landscape for this series; the CNCF project page does not list a category)
CNCF status Sandbox. Accepted June 26, 2021
Written in Go
License Apache-2.0
Modes Layer 2 with ARP (leader election) and Layer 3 with BGP (all nodes advertise); IPv4 and IPv6
Control plane Static pod (kubeadm) or DaemonSet (k3s and similar)
Services Needs a controller to assign addresses, normally the kube-vip cloud provider
Latest release read v1.2.4 (16 September), from a stored copy dated 23 September

The problem kube-vip solves

A Kubernetes cluster with three API servers still needs one address that clients can use. In a cloud, a managed load balancer provides it. On a rack, a shop floor or a server cupboard there is none. The usual answers are a pair of external proxies with keepalived, or a single server’s address, which is fine until that server fails.

Services have the same gap. A LoadBalancer Service on a cluster without a provider stays in the pending state, because nothing allocates or announces an address. The earlier MetalLB brief covers one answer to that second problem. kube-vip answers both with a single DaemonSet or static pod, which is why it suits clusters of three machines.

Key concepts

Term Meaning
Virtual IP (VIP) One address that is bound to one node at a time (ARP) or advertised by several nodes (BGP).
Leader election In ARP mode, the pods compete for a Kubernetes lease. The winner holds the address.
Gratuitous ARP A broadcast sent after the address moves, so neighbours update their address-to-MAC tables. Without it they may keep the old entry until it expires, typically within about 30 seconds.
Control plane mode cp_enable: the VIP fronts the API servers (port 6443 by default).
Services mode svc_enable: kube-vip advertises addresses of LoadBalancer Services.
Control plane load balancing lb_enable: IPVS spreads Layer 4 TCP traffic round-robin across the control plane nodes. In Layer 2 the IPVS service runs on the leader; in Layer 3 on every node.
kube-vip cloud provider The controller that picks an address from a pool and records it on the Service, in the kube-vip.io/loadbalancerIPs annotation.

Architecture

kube-vip architecture: kube-vip runs as a DaemonSet on the server nodes of a k3s cluster and holds a virtual IP for the control plane, so API clients reach one of three API servers through one address. For LoadBalancer Services, a cloud provider assigns an address from the kubevip ConfigMap and records it on the Service, kube-vip watches the Service and announces the address on the local network by ARP or BGP, and workload clients send traffic to it.

Open the zoomable diagram, or download it as SVG or PNG.

Component Responsibility
API clients kubectl, kubelets and joining nodes. They use the VIP, not a server address.
Control plane VIP The single address, on port 6443 by default, that stands in front of the API servers.
k3s servers The three API servers behind the address.
LoadBalancer Service A Service that asks for an external address; the address is stored in an annotation.
kube-vip The DaemonSet on the server nodes. Holds the VIP, watches Services and announces addresses.
Cloud provider Assigns a Service address from the configured pool.
kubevip ConfigMap The pool, as a range or a CIDR, global or per namespace.
Local network Receives ARP answers, or BGP routes sent to a router.
Workload clients Anything that sends traffic to a Service address.

Design principle. Keep the announcement on the nodes and the allocation in the cluster: kube-vip only advertises an address; which address a Service gets is decided by the pool and the cloud provider.

From a failed server to a reachable API

kube-vip control plane failover in five steps: the leader on server 1 holds the virtual IP, server 1 fails, server 2 wins the lease, server 2 binds the virtual IP, a gratuitous ARP tells neighbours the new MAC, and clients reconnect to the same address.

  1. The leader on server 1 holds the VIP and the node, or its kube-vip pod, is lost.
  2. The lease is no longer renewed and expires.
  3. The kube-vip pod on server 2 wins the election and binds the VIP to its interface.
  4. It sends a gratuitous ARP so that neighbours learn the new MAC address.
  5. Clients retry the same address and reach server 2.

This is the ARP case. In BGP mode every node advertises the address, so there is no single holder to move.

Installation

The steps below follow the kube-vip DaemonSet and k3s pages, read on 6 December 2026. They were not run for this brief. The DaemonSet page’s example flags date from older versions (its generation step uses v0.5.0 and its sample manifests v0.4.0), and were not checked against v1.2.4; run kube-vip manifest daemonset --help for the version you install.

1. Plan the addresses. Pick a VIP in the servers’ subnet, outside any DHCP range, and note the interface name (for example ens160).

export VIP=192.168.0.40
export INTERFACE=ens160
export KVVERSION=v1.2.4   # confirm the current release first

2. Create the k3s manifests directory and RBAC. k3s applies files in this directory automatically.

mkdir -p /var/lib/rancher/k3s/server/manifests/
curl https://kube-vip.io/manifests/rbac.yaml \
  > /var/lib/rancher/k3s/server/manifests/kube-vip-rbac.yaml

3. Define a kube-vip command. The documented k3s form uses ctr against the k3s containerd socket; the path shown is the RKE2 one from the page, and a k3s host may have its own k3s ctr.

export CTR="/var/lib/rancher/rke2/bin/ctr"
export CONTAINERD_SOCK="/run/k3s/containerd/containerd.sock"
$CTR --address $CONTAINERD_SOCK --namespace k8s.io image pull ghcr.io/kube-vip/kube-vip:$KVVERSION
alias kube-vip="$CTR --address $CONTAINERD_SOCK --namespace k8s.io run --rm --net-host ghcr.io/kube-vip/kube-vip:$KVVERSION vip /kube-vip"

4a. Generate the DaemonSet in ARP mode and append it to the same file, with a --- between the documents.

echo '---' >> /var/lib/rancher/k3s/server/manifests/kube-vip-rbac.yaml
kube-vip manifest daemonset \
  --interface $INTERFACE \
  --address $VIP \
  --inCluster \
  --taint \
  --controlplane \
  --services \
  --arp \
  --leaderElection >> /var/lib/rancher/k3s/server/manifests/kube-vip-rbac.yaml

4b. Or in BGP mode. The page binds the interface to lo, advertises from all nodes, and needs a unique router ID per node (bgp_routerid or bgp_routerinterface, taken from the pod IP).

export INTERFACE=lo
kube-vip manifest daemonset \
  --interface $INTERFACE \
  --address $VIP \
  --inCluster \
  --taint \
  --controlplane \
  --services \
  --bgp \
  --localAS 65000 \
  --bgpRouterID 192.168.0.2 \
  --bgppeers 192.168.0.10:65000::false,192.168.0.11:65000::false

The router at 192.168.0.10 and .11 must be configured to accept these sessions; that part is outside kube-vip.

5. Install the first k3s server. The k3s page states that the certificate must include the VIP, so pass the same address with --tls-san, and disable the built-in service load balancer if kube-vip will handle Services. --cluster-init and the join flags below are standard k3s options not covered by the kube-vip page.

curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --cluster-init \
  --tls-san $VIP --disable servicelb" sh -

Edit the generated kubeconfig so that server: points at https://$VIP:6443. Join the other two servers with --server https://$VIP:6443, the node token and the same --tls-san and --disable servicelb options.

6. Install the cloud provider and an address pool for Services.

kubectl apply -f https://raw.githubusercontent.com/kube-vip/kube-vip-cloud-provider/main/manifest/kube-vip-cloud-controller.yaml
kubectl create configmap -n kube-system kubevip \
  --from-literal range-global=192.168.0.220-192.168.0.230

7. Verify. ping $VIP, kubectl get nodes through the VIP, then stop the leader and repeat. Create a LoadBalancer Service and watch kubectl get svc -w until it shows an external address.

Production reference design

  1. Run three servers, all running kube-vip, with the VIP in their shared subnet and --tls-san set to the VIP and its DNS name.
  2. Use ARP when the servers share one Layer 2 segment, and BGP when the network team already runs routers that accept peers.
  3. Keep one pool for Services, per-namespace pools where teams must not share addresses, and keep every pool outside DHCP.
  4. Disable the k3s service load balancer so two controllers do not both answer for Services.
  5. Test a server loss, a switch port loss and a full cluster restart before putting workloads on it.
apiVersion: v1
kind: Service
metadata:
  name: web
  annotations:
    kube-vip.io/loadbalancerIPs: "192.168.0.221"   # kube-vip 0.5.12 or later
spec:
  type: LoadBalancer
  selector:
    app: web
  ports:
    - name: http
      port: 80
      protocol: TCP

Typical uses are small bare-metal clusters, edge sites, home labs and on-premises clusters without a hardware load balancer.

Choosing between ARP and BGP

The first real decision is the announcement mode, and it is a network decision before it is a Kubernetes one.

ARP (Layer 2) needs nothing from the network team. The servers must share one broadcast domain, one node holds the address at a time through leader election, and a gratuitous ARP tells the neighbours when it moves. The trade-offs follow from that. All traffic for the address enters through one node, so that node carries it until the lease moves. Failover speed depends on the lease timing and on how quickly the switches and neighbours update their tables. And it only works while the servers stay on one segment.

BGP (Layer 3) needs a router that accepts peering sessions, an AS number plan and an agreement with whoever runs the network. In return, every node advertises the address, so there is no single holder to move, and traffic can be spread by the router across the nodes. It also works when the servers sit in different subnets. The cost is operational: sessions have to be configured on both sides, a mistake on the router side looks like a kube-vip fault, and the open issues about routes being withdrawn during rollouts apply to this mode.

A simple rule works for most small sites. If three servers sit on one switch and nobody runs routers there, use ARP. If the site already has a router that speaks BGP and the team is comfortable with it, or the servers are on separate subnets, use BGP. Do not choose BGP only because it sounds more production-ready; an ARP setup that has been tested well is better than a BGP setup that nobody can debug.

Planning the addresses for a site

Most kube-vip problems on a first install come from the address plan rather than the software. Before writing any manifest, settle these points on paper:

Item Decision
Control plane VIP One address in the servers’ subnet, outside DHCP, with a DNS name that points to it. The certificate must include both the address and the name.
Service pool A range or CIDR outside DHCP and not used by any other device. Reserve it in the DHCP server and in the network documentation.
Interface name The exact name on every server. If the three machines use different names, the DaemonSet needs per-node handling.
Pools per namespace Decide whether teams share one pool or get their own. The kubevip ConfigMap supports both global and per-namespace entries.
Router and AS numbers (BGP) Local AS, peer addresses, who owns the router configuration and who is called when a session drops.
Firewall rules The API port on the VIP, and whatever the Services expose. Remember that the address moves between nodes, so rules must not be tied to one node.

Write the plan into the repository next to the manifests. A cluster rebuilt two years later by someone else needs to find where 192.168.0.40 came from.

A failover test plan

A virtual IP is only worth having if it moves when it should and stays put when it should not. Run these tests on the real network before the cluster carries anything that matters:

  1. Stop the leader node abruptly (power or hypervisor reset). Measure the time until kubectl get nodes works again through the VIP. Repeat several times; the first measurement is rarely typical.
  2. Stop the kube-vip pod on the leader, leaving the node running. This shows whether the lease is released and who takes over.
  3. Stop the k3s service gracefully on the leader. This is the case the open issue about graceful shutdown describes, so it deserves its own test on the version you install.
  4. Unplug the leader’s network cable or disable its switch port. The node is alive but unreachable, which is the most common real fault.
  5. Restart all three servers together. The VIP must come back without manual steps, and nodes must rejoin through it.
  6. Roll a Service with traffic running (a Deployment update behind a LoadBalancer Service), and watch for dropped connections, especially in BGP mode.
  7. Check from a second subnet or a laptop, not only from a server, because a VIP that answers locally can still be unreachable from users.

Record the measured times. If the answer to “how long is the API unavailable when a server dies?” is “about 20 seconds, measured on 6 December”, the team can set client timeouts and alerts from a fact instead of a guess.

How it differs from MetalLB in practice

The MetalLB brief covers the Service half in depth. The practical differences for a small cluster are these. MetalLB does not give the API server an address, so a control plane VIP still needs another tool, usually a keepalived and HAProxy pair or kube-vip itself. kube-vip covers both, so a three-server site runs one component instead of two, which is why this series picks it for the cinema clusters. MetalLB, on the other hand, is the more commonly used choice for Services alone, has a longer record, and has richer per-pool and per-address configuration. If your control plane address is already solved and Services are the only need, MetalLB deserves a fair comparison. If it is not solved, kube-vip is worth a trial.

Common mistakes

  • Putting the VIP or the Service pool inside the DHCP range. Another device receives the same address and the symptoms look random.
  • Forgetting the VIP in the API certificate. Everything works on a server address and fails on the VIP with a certificate error.
  • Leaving the k3s service load balancer enabled. Two controllers then compete to answer for Services.
  • Naming the wrong interface. The pod starts, logs no obvious error, and the address never appears on the network.
  • Testing failover only from the leader node itself. The address is local to that node and always answers there.
  • Assuming a moved address is instantly visible everywhere. Caches on switches and clients take time; measure from outside.
  • Sharing one address across Services without reading the open issues. Do it deliberately, or not at all.

Frequently asked questions

Does kube-vip replace an external load balancer? For the API server address and for Layer 4 Service addresses on a local network, yes. It does not terminate TLS, route by HTTP host, or replace an ingress controller or gateway. Those sit behind the Service address it announces.

Does it work on a single-server cluster? It runs, but a single server has no failover, so the VIP adds convenience (a stable address and name) and not availability.

Can the control plane and Services use different modes? The project documents the modes as options of the same component; check the documentation for your version before mixing them, and test the combination.

What happens to existing connections when the address moves? Connections to the old holder are lost and clients must reconnect. Kubernetes clients and kubectl retry, but long-lived custom clients may need their own retry logic.

Is it safe to run on the same nodes as the workloads? On small clusters it often is, because the servers also run workloads. Keep the pod’s privileges and the server nodes’ access in mind, and consider a taint if the servers should stay clean.

What is the main reason to choose something else? A cluster in a public cloud, where a managed load balancer is simpler and better supported, or a network where neither a flat segment nor BGP is available.

Troubleshooting

Entries come from the project documentation and the open-issue list. None was reproduced here, only the issue titles were read, and issue states change.

Symptom Cause or status What to do
kubectl through the VIP fails with a certificate error The VIP is not in the API server certificate (k3s page) Install k3s with --tls-san set to the VIP, as in step 5
A LoadBalancer Service stays pending No controller assigns addresses, or the pool is empty Install the cloud provider, check the kubevip ConfigMap in kube-system, and disable servicelb
After a failover some clients still reach the old node for a while Neighbours keep the old address-to-MAC entry until it expires, typically within about 30 seconds, unless gratuitous ARP is sent (architecture page) Keep gratuitous ARP enabled and test failover time on the real switches
The VIP does not move when the control-plane service stops gracefully (#1786, open when read) Reported as the VIP and lease never being released in ARP mode, leaving the container orphaned Test graceful shutdown as well as a power cut; read the issue
The VIP jumps between nodes while the API server is down (#1284, open when read) Reported with control-plane mode and ARP enabled Review the health-check behaviour for your version before relying on failover
The address keeps being advertised although the API server is down (#1145, open when read) Reported; the VIP follows the pod, not API health Monitor the API through the VIP, not only the node
A stale macvlan interface remains after a leader switch (#1735, open when read) Reported in the title only Check ip addr on the old leader after a failover
A BGP route is withdrawn during a rolling update although endpoints are ready (#1397, open when read) Reported in the title only Test Service rollouts with traffic running before trusting BGP for production Services
Two Services share a VIP with local traffic policy and the VIP stays on the old node (#1827, open when read) Reported in the title only Avoid sharing one address across Services until the issue is read and understood

Usage cases

  • Three-node bare-metal and edge clusters that need one stable API address without an external proxy.
  • On-premises clusters that want LoadBalancer Services from a pool of local addresses, with ARP on a flat network or BGP with routers.
  • Replacing MetalLB where one component for both the API address and Services is preferred. In the fictional ONE Cinemas design that Sprint 7 builds, each cinema’s three-node k3s cluster uses kube-vip for both jobs and kube-vip takes the place of MetalLB there. This is a design assumption and has not been built.
  • Lab clusters and clusters on a provider without load balancers.

Operational considerations

  • Scaling: the VIP in ARP mode lives on one node, so one server carries the control-plane traffic; IPVS load balancing (lb_enable) spreads it across servers.
  • HA: failover time depends on lease duration plus how fast neighbours learn the new MAC. Measure it.
  • Security: kube-vip needs privileged networking on the host and RBAC to read Services and manage leases. Limit it to the server nodes.
  • Sizing: the pods are small; the pool size, not the CPU, is the limit.
  • Pitfall: a flat L2 network is required for ARP. Across routed subnets use BGP.

Adoption

No adopters list was found on the repository page or the CNCF project page that were read, so no organisations are named here. Check the repository and the CNCF DevStats page for current users before citing any.

Alternatives

Solution Model Best suited to
MetalLB Allocates and announces Service addresses (ARP, NDP or BGP) Clusters whose control plane is handled elsewhere. See the MetalLB brief
keepalived with HAProxy VRRP address with an external proxy Teams that already run them outside Kubernetes
Cilium CNI with BGP and L2 announcements Clusters already on Cilium that want fewer parts
Cloud load balancer Managed Clusters in a public cloud

Strengths and limitations

Strengths Limitations
One component for the API address and Services Sandbox maturity
ARP and BGP, IPv4 and IPv6 ARP needs one Layer 2 segment
Runs as a static pod or a DaemonSet, including on k3s Services need the cloud provider as a second component
Small and simple to install Failover edge cases in the open issues need testing

Project status and roadmap

The releases page read shows v1.2.4 (16 September) as latest. It lists a security-related fix bundled in a CI change, WireGuard and BGP fixes for Service VIPs, and deadlock and race fixes. v1.2.2 added BFD support, nftables support for VIP addresses and a leader-election deadlock fix. v1.2.1 moved gobgp from v3 to v4.6.0, a major library change for BGP users. A roadmap was not read.

Recommendation

Trial. kube-vip fits small clusters that need one address for the API server and for Services. Prove failover, a graceful shutdown, a rolling Service update and a full restart on the real network before adopting it, and read the open failover issues against the version you install.

References: CNCF project page · Repository · Releases · DaemonSet installation · k3s usage · Architecture · Cloud provider · Issues

Spotted something wrong or out of date?Suggest a correction. I review every suggestion before changing the page.