Part of collection: Hyper-converged Homelab with Proxmox
Keepalived is a Loadbalancer to add ‘high availability` to Linux systemen. See the Keepalived documentatie for more background information.
This setup build on High Available Pi-hole failover cluster using Keepalived and Orbital Sync.
This setup is using a virtual ip address: 192.168.1.4, which is the only that is needed to access Application on the Docker Swarm. http://192.168.1.4:<port-number>
sudo apt-get install keepalived -y
Add the Script and the Master Node configuration to the Docker Manager servers:
# node_active_ready_check.sh
sudo curl https://gist.github.com/Drallas/4b965da52d259f0125f18bca39ffc8a3/raw/1774c4fad8783c02d0803b58ad1e6f250a432533/script-node_active_ready_check.sh -o /etc/scripts/node_active_ready_check.sh
sudo chmod +x /etc/scripts/node_active_ready_check.sh
# keepalived.conf
sudo curl https://gist.github.com/Drallas/4b965da52d259f0125f18bca39ffc8a3/raw/9368ec523fda134b68e66ce857b607c93b3678e7/script-keepalived-master.conf -o /etc/keepalived/keepalived.conf
Add the Keepalived configuration to the server:
# keepalived.conf
sudo curl https://gist.github.com/Drallas/4b965da52d259f0125f18bca39ffc8a3/raw/9368ec523fda134b68e66ce857b607c93b3678e7/script-keepalived-slave.conf -o /etc/keepalived/keepalived.conf
On change node's there can't be a script that check docker node ls
, hence it only monitors the status of the docker service.
Each slave has it's unique priority value and unicast_src_ip & unicast_peer configuration.
Edit nano /etc/keepalived/keepalived.conf
on each slave node, and change the priority and unicast blocks:
priority 165
priority 155
priority 155
priority 145
If the Node with ip 192.168.1.111
fails 192.168.1.112
becomes Master, if that one fails too 192.168.1.113
, etc.
sudo systemctl enable --now keepalived && sudo systemctl status keepalived
set the dns
<appname>.<domain>.<countrycode> A 192.168.1.4
Stop the Docker Service on the Master Node sudo systemctl stop docker.socket && sudo systemctl status docker.service
See on the High Available Pi-hole failover cluster using Keepalived and Orbital Sync test section more details how to test this.
When done start Docker again sudo systemctl start docker.service
and monitor sudo systemctl status keepalived
to see the Node assuming the MASTER status again.
got it and thats best way to learn, i only used what i did originally as thats whats all the examples had :-)
thats all that matters
sweet - not sure when i will get to virtioFS or the docker plugins for ceph... my folks are coming to visit from the UK for 3 weeks and i have a week to prep the house (it needs a lot of work) so may not get to look at either until mid to late Nov