openshift 진단 환경 구성(4) - LB (LoadBalancer) 설정

2025. 1. 20. 18:55인프라 환경 구성/openshift

3. LB (LoadBalancer) 설정

 

LB 구성을 위해 haproxy 를 설치하고 설정파일을 아래 내용으로 변경 합니다.

# yum -y install haproxy

# cp -arp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.ori
# nano /etc/haproxy/haproxy.cfg

global
  log         127.0.0.1 local2
  pidfile     /var/run/haproxy.pid
  maxconn     4000
  daemon

defaults
  mode                    http
  log                     global
  option                  dontlognull
  option http-server-close
  option                  redispatch
  retries                 3
  timeout http-request    10s
  timeout queue           1m
  timeout connect         10s
  timeout client          1m
  timeout server          1m
  timeout http-keep-alive 10s
  timeout check           10s
  maxconn                 3000

frontend stats
  bind *:1936
  mode            http
  log             global
  maxconn 10
  stats enable
  stats hide-version
  stats refresh 30s
  stats show-node
  stats show-desc Stats for az1 cluster 
  stats auth admin:az1@
  stats uri /stats

listen api-server-6443 
  bind *:6443
  mode tcp
  server bootstrap bootstrap.az1.eastiron.com:6443 check inter 1s backup 
  server master01 master01.az1.eastiron.com :6443 check inter 1s

listen machine-config-server-22623 
  bind *:22623
  mode tcp
  server bootstrap bootstrap.az1.eastiron.com :22623 check inter 1s backup 
  server master01 master01.az1.eastiron.com :22623 check inter 1s
 
listen ingress-router-443 
  bind *:443
  mode tcp
  balance source
  server worker01 worker01.az1.eastiron.com :443 check inter 1s

listen ingress-router-80 
  bind *:80
  mode tcp
  balance source
  server worker01 worker01.az1.eastiron.com :80 check inter 1s

 

데몬이 서버 부팅시 자동 구동 되도록 하고, 설정된 값은 재시작하여 적용합니다.

# systemctl enable haproxy

# systemctl start haproxy

 

오류)

- haproxy 시작 시 오류가 발생하면, /etc/resolv 파일의 nameserver가 제대로 설정되어 있는지 확인합니다.

 

참고로 HAproxy 로드발란서 상태 및 전송량 등 통계를 확인하려면 위에서 설정한대로 아래 URL 및 계정을 이용하여 로그인하면 됩니다.

http://115.68.142.99:1936/stats

계정 : admin / az1@