-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathhaproxy.cfg.j2
73 lines (65 loc) · 2.37 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
global
log 127.0.0.1 local2 debug
user haproxy
group haproxy
maxconn {{ config_options['global']['maxconn'] }}
defaults
log global
option dontlognull
timeout connect {{ config_options['defaults']['timeout_connect'] }}
timeout client {{ config_options['defaults']['timeout_client'] }}
timeout server {{ config_options['defaults']['timeout_server'] }}
timeout tunnel {{ config_options['defaults']['timeout_tunnel'] }}
timeout client-fin {{ config_options['defaults']['timeout_client_fin'] }}
maxconn {{ config_options['defaults']['maxconn'] }}
frontend http
{%- for binding in bindings %}
bind {{ binding }}:80
{%- endfor %}
option tcplog
mode tcp
default_backend http_backend
backend http_backend
mode tcp
balance source
option tcp-check
default-server inter 2s fall 2 rise 3
{%- for node in nodes -%}
{% if 'worker' in node['roles'] %}
server {{ node['name'] }} {{ node['internal_address'] }}:{{ target_ports.http }} check port {{ target_ports.http }} send-proxy
{%- endif %}
{%- endfor %}
frontend https
{%- for binding in bindings %}
bind {{ binding }}:443
{%- endfor %}
option tcplog
mode tcp
default_backend https_backend
backend https_backend
mode tcp
balance source
option tcp-check
default-server inter 2s fall 2 rise 3
{%- for node in nodes -%}
{% if 'worker' in node['roles'] %}
server {{ node['name'] }} {{ node['internal_address'] }}:{{ target_ports.https }} check port {{ target_ports.https }} send-proxy
{%- endif %}
{%- endfor %}
frontend kubernetes_api
{%- for binding in bindings %}
bind {{ binding }}:6443
{%- endfor %}
option tcplog
mode tcp
default_backend kubernetes_control_plane_nodes
backend kubernetes_control_plane_nodes
mode tcp
balance roundrobin
option tcp-check
default-server inter 2s fall 2 rise 3
{%- for node in nodes -%}
{% if 'control-plane' in node['roles'] %}
server {{ node['name'] }} {{ node['internal_address'] }}:6443 check port 6443
{%- endif %}
{%- endfor %}