self-hosting/roles/kubernetes/templates/keepalived.conf.j2

69 lines
1.2 KiB
Django/Jinja
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

global_defs {
{% if ansible_tun0 is defined %}
default_interface tun0
{% else %}
default_interface eth0
{% endif %}
}
vrrp_instance VI_1 {
{% if ansible_tun0 is defined %}
interface tun0
{% else %}
interface eth0
{% endif %}
track_interface {
{% if ansible_tun0 is defined %}
tun0
{% else %}
eth0
{% endif %}
}
{% if inventory_hostname == initial_master %}
state MASTER
priority 100
{% else %}
state BACKUP
priority 50
{% endif %}
virtual_router_id {{ router_id }}
nopreempt
unicast_peer {
{% for host in groups['k8s_masters'] %}
{{ hostvars[host]['vpn_ip'] }}
{% endfor %}
}
virtual_ipaddress {
{{ api_floating_ip }}/{{ api_floating_mask }}
}
authentication {
auth_type PASS
auth_pass d0cker
}
notify "/container/service/keepalived/assets/notify.sh"
}
virtual_server {{ api_floating_ip }} {{ api_floating_port }} {
delay_loop 10
protocol TCP
lb_algo rr
# Use direct routing
lb_kind DR
persistence_timeout 7200
{% for host in groups['k8s_masters'] %}
real_server {{ hostvars[host]['vpn_ip'] }} {{ api_floating_port }} {
weight 1
TCP_CHECK {
connect_timeout 5
connect_port 6443
}
}
{% endfor %}
}