不多说,上配置
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 6000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
#---------------------------------------------------------------------
defaults
mode tcp
log global
option tcplog
option dontlognull
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
#---------------------------------------------------------------------
listen stats
bind 0.0.0.0:9100
mode http
stats uri /status
stats refresh 30s
stats realm "Haproxy Manager"
stats auth admin:admin
stats hide-version
stats admin if TRUE
#---------------------------------------------------------------------
frontend k8s-master-default-nodepool-apiserver
bind *:6443
mode tcp
default_backend k8s-master-default-nodepool
#---------------------------------------------------------------------
backend k8s-master-default-nodepool
balance roundrobin
mode tcp
server k8s-master-default-nodepool-1 k8s-master-default-nodepool-1:6443 check weight 1 maxconn 2000 check inter 2000 rise 2 fall 3
server k8s-master-default-nodepool-2 k8s-master-default-nodepool-2:6443 check weight 1 maxconn 2000 check inter 2000 rise 2 fall 3
server k8s-master-default-nodepool-3 k8s-master-default-nodepool-3:6443 check weight 1 maxconn 2000 check inter 2000 rise 2 fall 3