HeadlinesBriefing favicon HeadlinesBriefing.com

How to Setup HA Kubernetes Cluster with Keepalived and HAProxy

DEV Community •
×

Creating a highly available Kubernetes cluster is essential for production environments to eliminate single points of failure. This guide details the implementation of a stacked etcd topology using kubeadm, HAProxy, and Keepalived. The architecture involves three control plane nodes, each running etcd, kube-apiserver, scheduler, and controller-manager.

HAProxy is configured to load balance traffic across the API servers on port 8443, while Keepalived manages a Virtual IP (VIP) for seamless failover. The tutorial provides specific configuration files for HAProxy and Keepalived, including priority settings for master/backup nodes. It walks through initializing the cluster with kubeadm, specifying the VIP in the controlPlaneEndpoint, and joining additional control plane nodes.

This setup ensures the cluster remains operational even if one master node fails, maintaining etcd quorum and API availability.