Skip to content

lhns/docker-swarm-keepalived

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-swarm-keepalived

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

Operator for keepalived on docker swarm.

Uses osixia/docker-keepalived.

Usage

  • 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

Docker images

https://github.com/lhns/docker-swarm-keepalived/pkgs/container/keepalived-swarm

Docker Stack

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

License

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