Member-only story
Building a High-Availability Kubernetes Cluster On-Premises: A Step-by-Step Guide
3 min readMay 10, 2024
High Availability (HA) is crucial for production-grade Kubernetes environments. This guide details setting up a highly available Kubernetes cluster on-premises using HAProxy and Keepalived across three master nodes.
Prerequisites
- Three servers (physical or virtual) are designated as master nodes.
- The YUM package manager was installed (typical for CentOS/RHEL systems).
- Sudo privileges on all three servers.
Step 1: Install HAProxy and Keepalived
First, install HAProxy and Keepalived on each master node. Execute the following command on each node:
sudo yum install haproxy keepalived -y
To download Keepalived without installing (for offline installation scenarios), use:
sudo yum install --downloadonly --downloaddir=/tmp/ keepalived
Step 2: Configure Keepalived
Script for API Server Health Checks
- Create the health check script on all master nodes at
/etc/keepalived/check_apiserver.sh
:
sudo vi /etc/keepalived/check_apiserver.sh
#…