LAB16: HA Proxy Load Balancer
LAB 41: HA Proxy Load balancer
Client → HAProxy (Public IP) → NodePorts → Ingress Controller → Services → PodsSTEP 1 — Install HAProxy on Your LB VM
sudo apt update
sudo apt install -y haproxyhaproxy -vSTEP 2 — Create HAProxy Config for Multiple Ingress Hosts
sudo nano /etc/haproxy/haproxy.cfgglobal
log /dev/log local0
maxconn 2048
defaults
log global
mode http
option httplog
timeout connect 5s
timeout client 50s
timeout server 50s
# FRONTEND: receives all HTTP traffic
frontend http_front
bind *:80
# Map by Host header
acl host_fileshare hdr(host) -i fileshare.local
use_backend nginx_ingress if host_fileshare
# Default (if host doesn't match)
default_backend nginx_ingress
# BACKEND: NGINX ingress (NodePort 32252)
backend nginx_ingress
balance roundrobin
mode http
server node_master 3.239.117.77:32252 check
server node_worker1 35.171.244.121:32252 check
server node_worker2 44.197.102.217:32252 check
STEP 3 — Restart HAProxy
STEP 5 — Add Local DNS Entries
STEP 6 — Test NGINX Ingress
OPTIONAL — Load Balance MySQL, Redis, Postgres, etc.
Last updated