Install Haproxy

apt install haproxy -y

Configure Haproxy

vim /etc/haproxy/haproxy.cfg 

edit

frontend kubernetes-frontend
    bind *:6443
    mode tcp
    option tcplog
    timeout client 10s
    default_backend kubernetes-backend

backend kubernetes-backend
    timeout connect 10s
    timeout server 10s
    mode tcp
    option tcp-check
    balance roundrobin
    server cp1 10.10.10.160:6443 check fall 3 rise 2
    server cp2 10.10.10.182:6443 check fall 3 rise 2
    server cp3 10.10.10.54:6443 check fall 3 rise 2

verify

haproxy -c -f /etc/haproxy/haproxy.cfg

restart

systemctl restart haproxy

check listen port

ss -tulpn | grep 6443

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *