Skip to content

lhns/docker-swarm-keepalived

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-swarm-keepalived

Docker Build Docker Stars Docker Pulls Docker Image Size Docker Image Layers Apache License 2.0

Runs keepalived in docker swarm.

Usage

  • Enable the "ip_vs" kernel module
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=200
docker node update node3 --label-add KEEPALIVED_PRIORITY=300
  • Deploy the stack

Docker images

https://hub.docker.com/r/lolhens/keepalived-swarm

Docker Stack

version: '3.7'

services:
  keepalived:
    image: lolhens/keepalived-swarm:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker:ro
    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

License

This project uses the Apache 2.0 License. See the file called LICENSE.