summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/base/templates/haproxy.cfg.j2
blob: 3de6ac00daa390e06e1291d1ff1d07b2e3c0cd84 (plain) (blame)
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
global
    log /dev/log local0
    log /dev/log local1 notice
    chroot /var/lib/haproxy
    stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
    stats timeout 30s
    user haproxy
    group haproxy
    daemon

frontend kube_api
{% if '_kubernetes_masters_' in group_names %}
    bind *:6443
{% else %}
    bind 127.0.0.1:6443
{% endif %}
    mode tcp
    timeout client 3h
    default_backend kube_api

backend kube_api
    mode tcp
{% if '_kubernetes_masters_' in group_names %}
    balance first
{% else %}
    balance roundrobin
{% endif %}
    option log-health-checks
    option httpchk GET /healthz
    http-check expect string ok
    default-server inter 5s fall 3 rise 2
    timeout connect 5s
    timeout server 3h
{% for master in groups['_kubernetes_masters_'] %}
    server {{ hostvars[master].inventory_hostname }} {{ hostvars[master].kubernetes_overlay_node_ip | default(hostvars[master].ansible_default_ipv4.address) }}:6442 {% if master == inventory_hostname %}id 1{% endif %} check check-ssl verify none
{% endfor %}