https://github.com/lhns/docker-swarm-keepalived
Operator for keepalived on docker swarm
https://github.com/lhns/docker-swarm-keepalived
docker failover ha keepalived metallb swarm vrrp
Last synced: 5 months ago
JSON representation
Operator for keepalived on docker swarm
- Host: GitHub
- URL: https://github.com/lhns/docker-swarm-keepalived
- Owner: lhns
- License: apache-2.0
- Created: 2021-01-09T02:42:50.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2026-01-12T21:37:37.000Z (5 months ago)
- Last Synced: 2026-01-13T01:55:00.742Z (5 months ago)
- Topics: docker, failover, ha, keepalived, metallb, swarm, vrrp
- Language: Shell
- Homepage: https://hub.docker.com/r/lolhens/keepalived-swarm
- Size: 38.1 KB
- Stars: 27
- Watchers: 2
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-swarm-keepalived
[](https://github.com/lhns/docker-swarm-keepalived/actions?query=workflow%3Abuild)
[](https://hub.docker.com/r/lolhens/keepalived-swarm)
[](https://hub.docker.com/r/lolhens/keepalived-swarm)
[](https://hub.docker.com/r/lolhens/keepalived-swarm)
[](https://www.apache.org/licenses/LICENSE-2.0)
Operator for [keepalived](https://github.com/acassen/keepalived) on docker swarm.
Uses [osixia/docker-keepalived](https://github.com/osixia/docker-keepalived).
## Usage
- Enable the "ip_vs" kernel module if not enabled
```sh
lsmod | grep -P '^ip_vs\s' || (echo "modprobe ip_vs" >> /etc/modules && modprobe ip_vs)
```
- Set a different priority for each node
```sh
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
## Docker images
https://github.com/lhns/docker-swarm-keepalived/pkgs/container/keepalived-swarm
## Docker Stack
```yml
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
```
## Helpful Links
- https://github.com/acassen/keepalived
- https://github.com/osixia/docker-keepalived
- https://geek-cookbook.funkypenguin.co.nz/ha-docker-swarm/keepalived/
## License
This project uses the Apache 2.0 License. See the file called LICENSE.