Skip to content

Instantly share code, notes, and snippets.

@dmancloud
Last active October 30, 2023 14:19
Show Gist options
  • Save dmancloud/3bdb3fdf2eaa3e2d42428f4a90de67a9 to your computer and use it in GitHub Desktop.
Save dmancloud/3bdb3fdf2eaa3e2d42428f4a90de67a9 to your computer and use it in GitHub Desktop.
Service LoadBalancer using leader election for ARP (Layer 2)

kube-vip - Service LoadBalancer using leader election (ARP)

kube-vip provides Kubernetes clusters with a virtual IP and load balancer for both the control plane (for building a highly-available cluster) and Kubernetes Services of type LoadBalancer without relying on any external hardware or software.

Documentation - https://kube-vip.io/docs/

Quickstart

Download & Deploy kube-vip controller

curl -sfL https://raw.githubusercontent.com/kube-vip/kube-vip-cloud-provider/main/manifest/kube-vip-cloud-controller.yaml > /var/lib/rancher/rke2/server/manifests/kube-vip-cloud-controller.yaml

Configure Loadbalancer Range

cat<<EOF > kube-vip-config.yaml
—-
apiVersion: v1
kind: ConfigMap
metadata:
  name: kube-vip
  namespace: kube-system
data:
  range-global: 192.168.3.220-192.168.3.230
EOF

cp kube-vip-config.yaml > /var/lib/rancher/rke2/server/manifests

Verify Loadbalancer Is Working

kubectl create deploy nginx --image=nginx:stable-alpine
kubectl expose deploy nginx --port=80 -type-LoadBalancer

kubectl get service

curl http://<IP_Address>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment