MultiMaster_K3S_HA1
This commit is contained in:
commit
22166acee1
11
MultiMaster_K3S_HA/checkapi.sh
Normal file
11
MultiMaster_K3S_HA/checkapi.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
errorExit() {
|
||||
echo "*** $@" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
curl --silent --max-time 2 --insecure https://localhost:6443/ -o /dev/null || errorExit "Error GET https://localhost:6443/"
|
||||
if ip addr | grep -q 192.168.101.111; then
|
||||
curl --silent --max-time 2 --insecure https://192.168.101.111:6443/ -o /dev/null || errorExit "Error GET https://172.16.16.100:6443/"
|
||||
fi
|
15
MultiMaster_K3S_HA/haproxy.cfg
Normal file
15
MultiMaster_K3S_HA/haproxy.cfg
Normal file
@ -0,0 +1,15 @@
|
||||
frontend kubernetes-frontend
|
||||
bind *:6443
|
||||
mode tcp
|
||||
option tcplog
|
||||
default_backend kubernetes-backend
|
||||
|
||||
backend kubernetes-backend
|
||||
option httpchk GET /healthz
|
||||
http-check expect status 200
|
||||
mode tcp
|
||||
option ssl-hello-chk
|
||||
balance roundrobin
|
||||
server kmaster1 192.168.100.56:6443 check fall 3 rise 2
|
||||
server kmaster2 192.168.100.65:6443 check fall 3 rise 2
|
||||
server kmaster3 192.168.100.66:6443 check fall 3 rise 2
|
26
MultiMaster_K3S_HA/keepalived.conf
Normal file
26
MultiMaster_K3S_HA/keepalived.conf
Normal file
@ -0,0 +1,26 @@
|
||||
vrrp_script checkapi {
|
||||
script "/etc/keepalived/checkapi.sh"
|
||||
interval 2 # Uruchamiaj skrypt co 2 sekundy
|
||||
timeout 5 # Poczekaj do 5 sekund na skrypt przed przyjęciem niezerowego kodu wyjścia
|
||||
fall 3 # Jeśli skrypt zwraca kod niezerowy 3 razy z rzędu, wprowadź stan FAULT
|
||||
rise 3 # Jeśli skrypt zwraca kod zero 3 razy z rzędu, wyjdź ze stanu FAULT
|
||||
weight -10 # Zmniejsz priorytet o 10 przy wykrytej awarii
|
||||
}
|
||||
|
||||
vrrp_instance VI_1 {
|
||||
state ACTIVE
|
||||
interface enp0s3
|
||||
virtual_router_id 1
|
||||
priority 100
|
||||
advert_int 2
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass mojehaslo
|
||||
}
|
||||
virtual_ipaddress {
|
||||
192.168.101.111
|
||||
}
|
||||
track_script {
|
||||
checkapi
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user