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 :

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 10.0.0.11:6443 check
  server cp2 10.0.0.12:6443 check
  server cp3 10.0.0.13:6443 check

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