Skip to content

Instantly share code, notes, and snippets.

@Markieta
Created October 30, 2021 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Markieta/da704a0eb144d069a88902b88323c5d9 to your computer and use it in GitHub Desktop.
Save Markieta/da704a0eb144d069a88902b88323c5d9 to your computer and use it in GitHub Desktop.
Simple haproxy.cfg for load balancing with OpenShift Container Platform (OCP) 4.x
global
log 127.0.0.1 local2
pidfile /var/run/haproxy.pid
maxconn 4000
daemon
defaults
mode http
log global
option dontlognull
option http-server-close
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
frontend stats
bind *:1936
mode http
log global
maxconn 10
stats enable
stats hide-version
stats refresh 30s
stats show-node
stats show-desc Stats for ocp cluster
stats auth admin:ocp4
stats uri /stats
listen api-server-6443
bind api.ocp.markieta.com:6443
mode tcp
# server bootstrap bootstrap.ocp.markieta.com:6443 check inter 1s backup
server master-01 master-01.ocp.markieta.com:6443 check inter 1s
server master-02 master-02.ocp.markieta.com:6443 check inter 1s
server master-03 master-03.ocp.markieta.com:6443 check inter 1s
listen machine-config-server-22623
bind api-int.ocp.markieta.com:22623
mode tcp
# server bootstrap bootstrap.ocp.markieta.com:22623 check inter 1s backup
server master-01 master-01.ocp.markieta.com:22623 check inter 1s
server master-02 master-02.ocp.markieta.com:22623 check inter 1s
server master-03 master-03.ocp.markieta.com:22623 check inter 1s
listen ingress-router-443
bind 192.168.0.102:443
mode tcp
balance source
server worker-01 worker-01.ocp.markieta.com:443 check inter 1s
server worker-02 worker-02.ocp.markieta.com:443 check inter 1s
server worker-03 worker-03.ocp.markieta.com:443 check inter 1s
listen ingress-router-80
bind 192.168.0.102:80
mode tcp
balance source
server worker-01 worker-01.ocp.markieta.com:80 check inter 1s
server worker-02 worker-02.ocp.markieta.com:80 check inter 1s
server worker-03 worker-03.ocp.markieta.com:80 check inter 1s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment