Skip to content

Instantly share code, notes, and snippets.

@lovellfelix
Created December 16, 2019 02:18
Show Gist options
  • Save lovellfelix/b37b88819a3e80c3175e51b33e3d80e2 to your computer and use it in GitHub Desktop.
Save lovellfelix/b37b88819a3e80c3175e51b33e3d80e2 to your computer and use it in GitHub Desktop.
#!/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 VIRTUAL_IP; then
curl --silent --max-time 2 --insecure https://VIRTUAL_IP:6443/ -o /dev/null || errorExit "Error GET https://VIRTUAL_IP:6443/"
fi
...
frontend k8s-api
bind *:5443
mode tcp
option tcplog
default_backend k8s-api
backend k8s-api
mode tcp
option tcplog
option tcp-check
balance roundrobin
default-server inter 10s downinter 5s rise 2 fall 2 slowstart 60s maxconn 250 maxqueue 256 weight 100
server k8s-api-1 192.168.xx.x:6443 check
server k8s-api-2 192.168.xx.x:6443 check
server k8s-api-3 192.168.xx.x:6443 check
server k8s-api-4 192.168.xx.x:6443 check
! Configuration File for keepalived
global_defs {
router_id LVS_DEVEL
}
vrrp_script check_apiserver {
script "/etc/keepalived/check_apiserver.sh"
interval 3
weight -2
fall 10
rise 2
}
vrrp_instance VI_1 {
state MASTER
interface wlan0
virtual_router_id 51
priority 101
authentication {
auth_type PASS
auth_pass mysuperstrongpassword
}
virtual_ipaddress {
192.168.xx.x
}
track_script {
check_apiserver
}
}
export USER=pi
export SERVER_IP=192.168.x.x
export NEXT_SERVER_IP=192.168.x.x
k3sup install \
--ip $SERVER_IP \
--user $USER \
--k3s-extra-args '--no-deploy traefik' \
--local-path ~/.kube/config \
--cluster
k3sup join \
--ip $NEXT_SERVER_IP \
--user $USER \
--server-user $USER \
--k3s-extra-args '--no-deploy traefik' \
--server-i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment