forked from guohongze/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
haproxy.cfg.j2
56 lines (52 loc) · 1.62 KB
/
haproxy.cfg.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
nbproc 1
defaults
log global
timeout connect 5000
timeout client 10m
timeout server 10m
listen kube-master
bind 0.0.0.0:{{ KUBE_APISERVER.split(':')[2] }}
mode tcp
option tcplog
balance {{ BALANCE_ALG }}
{% for host in groups['kube-master'] %}
server {{ host }} {{ host }}:6443 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% for host in groups['new-master'] %}
server {{ host }} {{ host }}:6443 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% if INGRESS_NODEPORT_LB == "yes" %}
listen ingress-node
bind 0.0.0.0:80
mode tcp
option tcplog
balance {{ BALANCE_ALG }}
{% for host in groups['kube-node'] %}
server {{ host }} {{ host }}:23456 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% for host in groups['new-node'] %}
server {{ host }} {{ host }}:23456 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% endif %}
{% if INGRESS_TLS_NODEPORT_LB == "yes" %}
listen ingress-node-tls
bind 0.0.0.0:443
mode tcp
option tcplog
balance {{ BALANCE_ALG }}
{% for host in groups['kube-node'] %}
server {{ host }} {{ host }}:23457 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% for host in groups['new-node'] %}
server {{ host }} {{ host }}:23457 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% endif %}