Skip to content

HAProxy Installation

This content is not available in your language yet.

  1. XXXXX

    Terminal window
    sudo -i
  2. XXXXX

    Terminal window
    apt update
    apt upgrade -y
  3. XXXXX

    Terminal window
    apt install haproxy
  1. XXXXXXXXX

    XXXXXXX vim (XXXXXXX)

    Terminal window
    vim /etc/haproxy/haproxy.cfg
  2. XXXXXXXXXXXXXXXXXX

    # ... (deducted) ### DO NOT INCLUDE THIS ! ###
    frontend k8s
    bind *:80,*:443
    mode tcp
    option tcplog
    use_backend k8s_https if { dst_port 443 }
    default_backend k8s_http
    frontend haproxy_exporter
    bind *:8405
    mode http
    http-request use-service prometheus-exporter if { path /metrics }
    no log
    backend k8s_http
    mode tcp
    server worker1 10.1.0.111:30080 check
    server worker2 10.1.0.112:30080 check
    server worker3 10.1.0.113:30080 check
    backend k8s_https
    mode tcp
    server worker1 10.1.0.111:30443 check
    server worker2 10.1.0.112:30443 check
    server worker3 10.1.0.113:30443 check
    frontend api_servers
    bind *:6443
    mode tcp
    option tcplog
    default_backend k8s_api_https
    backend k8s_api_https
    balance roundrobin
    mode tcp
    option tcp-check
    default-server inter 10s downinter 5s rise 2 fall 2 slowstart 60s maxconn 250 maxqueue 256 weight 100
    server master1 10.1.0.101:6443 check
    server master2 10.1.0.102:6443 check
    server master3 10.1.0.103:6443 check
    listen rke_api
    bind *:9345
    mode tcp
    option tcplog
    balance roundrobin
    option tcp-check
    default-server inter 10s downinter 5s rise 2 fall 2 slowstart 60s maxconn 250 maxqueue 256 weight 100
    server master1 10.1.0.101:9345 check
    server master2 10.1.0.102:9345 check
    server master3 10.1.0.103:9345 check

    XXXXXXXXXXXXXXXXX

    • haproxy_exporter
    • k8s_http
    • k8s_https
    • k8s_api_https
    • rke_api

    XXXXXXXXXXXXXXXXXXXXXXXX

    XXXXXXXXXXXXXXXXXXX server master<N> <IP-ADDRESS>:<PORT> check where N is number, XXXXXXXXXXXXXXXXXXXX

    XXXXXXXXXXXXXXXXXXX server worker<N> <IP-ADDRESS>:<PORT> check where N is number, XXXXXXXXXXXXXXXXXXXX

  3. XXXXXXXXXXXXXXXXXX

    Terminal window
    systemctl restart haproxy