Operator for keepalived on docker swarm.
Uses osixia/docker-keepalived.
- Enable the "ip_vs" kernel module if not enabled
lsmod | grep -P '^ip_vs\s' || (echo "modprobe ip_vs" >> /etc/modules && modprobe ip_vs)
- Set a different priority for each node
docker node update node1 --label-add KEEPALIVED_PRIORITY=100
docker node update node2 --label-add KEEPALIVED_PRIORITY=101
docker node update node3 --label-add KEEPALIVED_PRIORITY=102
- Deploy the stack
https://github.com/lhns/docker-swarm-keepalived/pkgs/container/keepalived-swarm
version: '3.8'
services:
keepalived:
image: ghcr.io/lhns/keepalived-swarm
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- host
deploy:
mode: global
placement:
constraints: [node.role == manager]
environment:
KEEPALIVED_VIRTUAL_IPS: "192.168.1.231, 192.168.1.232"
networks:
host:
external: true
name: host
- https://github.com/acassen/keepalived
- https://github.com/osixia/docker-keepalived
- https://geek-cookbook.funkypenguin.co.nz/ha-docker-swarm/keepalived/
This project uses the Apache 2.0 License. See the file called LICENSE.