talira

kube-vip

Kubernetes Control Plane Virtual IP and Load-Balancer

open sourceApache-2.0self-hostablefree

kube-vip gives a Kubernetes cluster a highly available virtual IP for its control plane and LoadBalancer addresses for its Services, without an external load balancer: it's made for bare metal, edge devices such as Raspberry Pis, and virtual machines. It advertises addresses with ARP (layer 2, one elected leader holds each address), BGP (layer 3, every node advertises it) or the routing table, over IPv4 or IPv6, can balance the API server across control plane nodes with IPVS, and runs as a static pod, a DaemonSet or a plain binary under systemd. Its separate cloud provider hands out Service addresses from global or per-namespace pools, or from DHCP. Guides cover kubeadm, K3s and kind. Apache-2.0, a series of LF Projects.

Ways to install

Problems it solves

  • give my bare-metal Kubernetes control plane one highly available IP address without HAProxy and keepalived
  • LoadBalancer services on bare metal or a homelab where there's no cloud load balancer
  • a floating virtual IP for the Kubernetes API server that moves when a control plane node dies
  • advertise Kubernetes service IPs to our routers over BGP
  • hand out LoadBalancer IPs from a different address pool for each namespace
  • get LoadBalancer service addresses from the network's existing DHCP server
  • highly available K3s cluster on Raspberry Pis with a shared API address
  • a virtual IP for the API server before the cluster even exists, during kubeadm init
  • load balance API server traffic across all control plane nodes
  • IPv6 or dual-stack virtual IPs for Kubernetes

Features

  • control plane virtual IP for IPv4 or IPv6 with leader election
  • ARP (layer 2) and BGP (layer 3) advertisement, plus routing table mode
  • Services of type LoadBalancer, with per-service leader election in ARP mode
  • IPVS layer 4 round-robin load balancing across control plane nodes
  • kube-vip cloud provider with global or per-namespace CIDR and range pools
  • addresses from an existing network's DHCP and gateway exposure via UPnP
  • WireGuard mode
  • static pod or DaemonSet installs, or a static binary under systemd
  • Linux binaries for amd64, arm64, ARMv7, ppc64le and s390x
  • guides for kubeadm, K3s and kind
View 1 more
  • Helm chart from the project's own chart repository

Limitations

  • No load balancing across nodes in ARP mode: one elected leader node holds each virtual IP, while BGP mode advertises it from every node2
  • Control plane load balancing needs the virtual IP in the same subnet as the control plane nodes: NAT-based load balancing isn't supported yet2

Alternatives

The same job

These do what kube-vip does.

  1. MetalLB A network load-balancer implementation for Kubernetes using standard routing protocols
  2. Cilium eBPF-based Networking, Security, and Observability

Compare kube-vip with the top 3