global log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners stats timeout 30s user haproxy group haproxy daemon # Default SSL material locations ca-base /etc/ssl/certs crt-base /etc/ssl/private # See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets defaults log global mode http option httplog option dontlognull timeout connect 5000 timeout client 50000 timeout server 50000 errorfile 400 /etc/haproxy/errors/400.http errorfile 403 /etc/haproxy/errors/403.http errorfile 408 /etc/haproxy/errors/408.http errorfile 500 /etc/haproxy/errors/500.http errorfile 502 /etc/haproxy/errors/502.http errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http # Frontend 설정: Kubernetes API에 대한 트래픽을 수신하는 부분 frontend kubernetes_api mode tcp # TCP 모드로 작동 bind *:6443 # 모든 IP에서 6443 포트에 바인딩 option tcplog # TCP 요청에 대한 로그 기록 활성화 default_backend kubernetes_master # 기본 백엔드로 kubernetes_master 설정 # Backend 설정: Kubernetes 마스터 노드에 대한 트래픽을 처리하는 부분 backend kubernetes_master mode tcp # TCP 모드로 작동 balance roundrobin # 라운드 로빈 방식으로 트래픽 분산 option tcplog # TCP 요청에 대한 로그 기록 활성화 option dontlog-normal # 정상적인 요청에 대한 로그 기록 비활성화 option dontlognull # NULL 요청에 대한 로그 기록 비활성화 option tcp-check # TCP 체크 기능 활성화 (서버 상태 확인) default-server check maxconn 1500 # 기본 서버에 대한 체크 및 최대 연결 수 설정 # Kubernetes 마스터 서버 설정 server master1 10.140.224.141:6443 check # 첫 번째 마스터 노드 server master2 10.140.224.142:6443 check # 두 번째 마스터 노드 server master3 10.140.224.143:6443 check # 세 번째 마스터 노드 frontend http mode http bind :80 # different with nexus default_backend http #http-request redirect scheme https code 301 unless { ssl_fc } #redirect scheme https code 301 if !{ ssl_fc } frontend https mode tcp bind :443 default_backend https #http-request redirect scheme https code 301 unless { ssl_fc } #redirect scheme https code 301 if !{ ssl_fc } backend http mode http balance roundrobin option tcplog option dontlog-normal option dontlognull option tcp-check default-server check maxconn 1500 server worker1 10.140.224.144:30100 check inter 10s fastinter 2s rise 1 fall 3 weight 1 server worker2 10.140.224.145:30100 check inter 10s fastinter 2s rise 1 fall 3 weight 1 server worker3 10.140.224.148:30100 check inter 10s fastinter 2s rise 1 fall 3 weight 1 backend https mode tcp balance roundrobin option tcplog option dontlog-normal option dontlognull option tcp-check default-server check maxconn 1500 server worker1 10.140.224.144:30101 check inter 10s fastinter 2s rise 1 fall 3 weight 1 server worker2 10.140.224.145:30101 check inter 10s fastinter 2s rise 1 fall 3 weight 1 server worker3 10.140.224.148:30101 check inter 10s fastinter 2s rise 1 fall 3 weight 1