Scripts2026年7月1日·1 分钟阅读

kube-vip — Virtual IP and Load Balancing for Kubernetes

kube-vip provides a virtual IP and load balancer for both the Kubernetes control plane and service type LoadBalancer, enabling highly available clusters without external hardware or cloud load balancers.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
kube-vip Overview
先审查命令
npx -y tokrepo@latest install 4ad75332-7520-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

kube-vip provides Kubernetes clusters with a virtual IP address for the control plane and LoadBalancer-type Services without requiring external load balancers or cloud provider integrations. It is particularly valuable for bare-metal and on-premises Kubernetes deployments where cloud load balancers are unavailable.

What kube-vip Does

  • Assigns a floating virtual IP to the Kubernetes control plane for high availability
  • Implements LoadBalancer-type Services on bare-metal clusters
  • Uses ARP or BGP to advertise virtual IP addresses on the network
  • Elects a leader node to hold the VIP using Raft-based leader election
  • Runs as a static pod, DaemonSet, or standalone binary

Architecture Overview

kube-vip runs on each control plane node and participates in leader election. The elected leader binds the virtual IP to its network interface and responds to ARP requests (layer 2 mode) or advertises the route via BGP (layer 3 mode). For Service load balancing, kube-vip watches the Kubernetes API for Services of type LoadBalancer and assigns addresses from a configured IP pool, handling traffic distribution across backends.

Self-Hosting & Configuration

  • Deploy as a static pod on control plane nodes or as a DaemonSet cluster-wide
  • Configure ARP mode for simple layer 2 environments on a flat network
  • Configure BGP mode for routed environments with upstream router peering
  • Define IP address pools for Service LoadBalancer allocation via ConfigMap or CIDR range
  • Set leader election lease duration and renewal parameters for failover speed

Key Features

  • Control plane VIP eliminates single points of failure without external dependencies
  • Dual-mode networking with ARP for layer 2 and BGP for layer 3 environments
  • Service LoadBalancer implementation replaces MetalLB for many use cases
  • Lightweight single binary with no external dependencies
  • Works with any Kubernetes distribution including K3s, kubeadm, and RKE2

Comparison with Similar Tools

  • MetalLB — more mature LoadBalancer implementation but does not provide control plane VIP
  • Keepalived — traditional Linux VIP failover, requires separate configuration outside Kubernetes
  • Cloud LB (AWS NLB, GCP LB) — managed service, not available on bare metal or edge
  • HAProxy + Keepalived — common pattern for HA control plane, more components to manage

FAQ

Q: Can kube-vip replace MetalLB? A: For many use cases, yes. kube-vip provides both control plane VIP and Service LoadBalancer functionality in a single component. MetalLB offers more advanced features like L2/BGP co-existence and community support.

Q: Does kube-vip work with K3s? A: Yes. kube-vip integrates with K3s as a DaemonSet and can provide the control plane VIP and LoadBalancer services for K3s clusters.

Q: What is the failover time when the leader node goes down? A: Failover typically completes in 5-10 seconds depending on leader election lease configuration and ARP cache expiry on the network.

Q: Can I use kube-vip in a cloud environment? A: It is possible but generally unnecessary since cloud providers offer native load balancers. kube-vip is designed for environments without cloud LB support.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产