我在我的RockyLinux配置:
HAProxy,然后进行启动:
systemctl start haproxy
global
maxconn 2000
ulimit-n 16384
log 127.0.0.1 local0 err
stats timeout 30s
defaults
log global
mode http
option httplog
timeout connect 5000
timeout client 50000
timeout server 50000
timeout http-request 15s
timeout http-keep-alive 15s
frontend monitor-in
bind *:33305
mode http
option httplog
monitor-uri /monitor
listen stats
bind *:8006
mode http
stats enable
stats hide-version
stats uri /stats
stats refresh 30s
stats realm Haproxy\ Statistics
stats auth admin:admin
frontend k8s-master
bind 0.0.0.0:16443
bind 127.0.0.1:16443
mode tcp
option tcplog
tcp-request inspect-delay 5s
default_backend k8s-master
backend k8s-master
mode tcp
option tcplog
option tcp-check
balance roundrobin
default-server inter 10s downinter 5s rise 2 fall 2 slowstart 60s
maxconn 250
maxqueue 256
weight 100
server k8s-master01 192.168.139.171:6443 check
server k8s-master02 192.168.139.112:6443 check
server k8s-master03 192.168.139.198:6443 check报错信息是:
Apr 08 21:23:11 k8s-master01 systemd[1]: Starting HAProxy Load Balancer...
Apr 08 21:23:11 k8s-master01 haproxy[22967]: [ALERT] 097/212311 (22967) : parsing [/etc/haproxy/haproxy.cfg:48] : unknown keyword 'maxqueue' in 'backend' section
Apr 08 21:23:11 k8s-master01 haproxy[22967]: [ALERT] 097/212311 (22967) : parsing [/etc/haproxy/haproxy.cfg:49] : unknown keyword 'weight' in 'backend' section
Apr 08 21:23:11 k8s-master01 haproxy[22967]: [ALERT] 097/212311 (22967) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
Apr 08 21:23:11 k8s-master01 haproxy[22967]: [ALERT] 097/212311 (22967) : Fatal errors found in configuration.
Apr 08 21:23:11 k8s-master01 systemd[1]: haproxy.service: Control process exited, code=exited status=1
Apr 08 21:23:11 k8s-master01 systemd[1]: haproxy.service: Failed with result 'exit-code'.
Apr 08 21:23:11 k8s-master01 systemd[1]: Failed to start HAProxy Load Balancer.版本:
$ haproxy -v
HA-Proxy version 1.8.27-493ce0b 2020/11/06
Copyright 2000-2020 Willy Tarreau <willy@haproxy.org>