Kubernetes Control Plane Load Balancer with HAProxy on VyOS
Contents
Prerequisites
- VyOS configured as per Setting Up VyOS as a Proxmox VM
- Two or more Kubernetes control plane nodes reachable on the lab network
- The control plane nodes’ lab IPs noted — these become the HAProxy backends
Why Load Balance the Control Plane
Each control plane node runs an instance of the Kubernetes API server on port 6443. Without a load balancer in front of them, every client — kubectl, worker nodes, internal services — must point directly at one control plane node. If that node goes down, the API becomes unreachable even though the other nodes are healthy.
A load balancer provides a single stable endpoint. Clients connect to one address; HAProxy distributes the connections across all healthy control plane nodes and removes a node from rotation automatically if its health check fails.
VyOS includes HAProxy support natively — no separate VM or LXC container is needed.
Official reference: VyOS HAProxy
Configuring HAProxy on VyOS
The Kubernetes API server uses plain TCP on port 6443. HAProxy is configured in TCP mode so it forwards connections without inspecting or terminating TLS — the API server handles TLS end-to-end.
| |
bind '0.0.0.0'— listens on all VyOS interfaces, including the VRRP virtual IP; connections always reach the active router regardless of which node holds the VIPmode tcp— HAProxy forwards raw TCP without terminating TLS; the API server certificate is presented directly to the clientbalance roundrobin— distributes new connections evenly across healthy backendscheck— enables TCP health checks; a backend is removed from rotation if it stops responding
Verifying
From any lab host, confirm HAProxy is accepting connections on the VyOS IP:
| |
A response of ok means HAProxy forwarded the request to a healthy control plane node. The -k flag skips certificate verification — use your CA bundle if you have one deployed.
Check which backends are currently healthy from the VyOS operational mode:
| |
What’s Next
- Setting Up a Kubernetes Cluster — initialising the cluster with this load balancer as the control plane endpoint
- VRRP redundancy — adding a second VyOS instance so the load balancer itself has no single point of failure
- BGP peering with Kubernetes — dynamically routing Kubernetes service IPs through VyOS