Skip to main content

Load-Balancer et Initialisation (Keepalived et HAProxy)

Installation et Configuration de HAProxy :

Sur chaque master node

Installation

sudo apt -y install haproxy
sudo systemctl enable --now haproxy

Configuration sudo nano /etc/haproxy/haproxy.cfg :

global
  maxconn 4096
  log /dev/log local0
  daemon

defaults
  mode tcp
  log global
  option tcplog
  timeout connect 5s
  timeout client  60s
  timeout server  60s

# API Kubernetes : 6443 en TCP (TLS passthrough)
frontend k8s_api
  bind 0.0.0.0:6443
  default_backend k8s_api_back

backend k8s_api_back
  mode tcp
  balance roundrobin
  option tcp-check
  # Remplace par les IPs réelles de tes masters
  server cp1 192.168.20.240:6443 check
  server cp2 192.168.20.241:6443 check
  server cp3 192.168.20.242:6443 check

Redémarrage de HAProxy pour appliquer les changements sudo systemctl restart haproxy