-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathkeepalived.conf.tmpl
58 lines (54 loc) · 1.91 KB
/
keepalived.conf.tmpl
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
global_defs {
vrrp_garp_master_delay 5
vrrp_garp_master_refresh 60
vrrp_garp_lower_prio_repeat 1
enable_script_security
}
vrrp_script chk_url{
# Wrap in timeout as a workaround for https://github.com/acassen/keepalived/issues/1364
# timeout must be lower than interval to prevent keepalived log spam (e.g. "process ... terminated with signal 15")
script "/bin/bash -c '/usr/bin/timeout $(echo {{getenv "CHECK_SERVICE_INTERVAL" "2"}}*0.9|bc) /opt/bin/vrrp_check.sh URL_CHECK {{getenv "CHECK_SERVICE_URL" "http://127.0.0.1:10254/healthz"}}'"
interval {{env.Getenv "CHECK_SERVICE_INTERVAL" "2"}}
fall {{env.Getenv "CHECK_SERVICE_FAILAFTER" "2"}}
rise 2
}
vrrp_script chk_kubelet {
script "/bin/bash -c '/usr/bin/timeout $(echo {{getenv "CHECK_KUBELET_INTERVAL" "5"}}*0.9|bc) /opt/bin/vrrp_check.sh URL_CHECK {{getenv "CHECK_SERVICE_URL" "http://127.0.0.1:10248/healthz"}}'"
interval {{getenv "CHECK_KUBELET_INTERVAL" "5"}}
fall {{getenv "CHECK_KUBELET_FAILAFTER" "5"}}
rise 2
}
vrrp_script chk_kubeapi {
script "/bin/bash -c '/usr/bin/timeout $(echo {{getenv "CHECK_KUBEAPI_INTERVAL" "5"}}*0.9|bc) /opt/bin/vrrp_check.sh API_CHECK'"
interval {{getenv "CHECK_KUBEAPI_INTERVAL" "5"}}
fall {{getenv "CHECK_KUBEAPI_FAILAFTER" "5"}}
rise 2
}
vrrp_instance CLUSTER_VIP {
interface {{getenv "VRRP_IFACE" "eth0"}}
virtual_router_id {{getenv "VIRTUAL_ROUTER_ID" "10"}}
state BACKUP
{{- if eq (getenv "VRRP_NOPREEMPT" | toLower) "true" }}
nopreempt
{{- else }}
preempt_delay 5
{{- end }}
priority 100
advert_int 1
virtual_ipaddress {
{{ .Env.VIP_ADDR_CIDR }} dev {{getenv "VIP_IFACE" "eth0"}}
}
track_script {
chk_url
{{- if eq (getenv "CHECK_KUBELET" "true" | toLower) "true" }}
chk_kubelet
{{- end }}
{{- if eq (getenv "CHECK_KUBEAPI" "true" | toLower) "true" }}
chk_kubeapi weight -40
{{- end }}
}
authentication {
auth_type PASS
auth_pass {{ .Env.AUTH_PASSWORD }}
}
}