Sign inSign up

pioneerm/keepalived

By pioneerm

•Updated about 2 years ago

Use keepalived as the K3s VIP to sustain K3s master node services.

Image
Networking
Internet of things
0

181

pioneerm/keepalived repository overview

Please mount your own keepalived.conf into '/etc/keepalived/' and run the docker command like this:

docker run --restart=always --network=host --log-opt max-size=50m --log-opt max-file=4  -v /etc/localtime:/etc/localtime -v /etc/keepalived:/etc/keepalived --privileged --name keepalived -it pioneerm/keepalived:2.2.4-r2

The keepalived.conf defines 'chk_k3s' to check the port 6443 (k3s api server) on master nodes.
keepalived.conf:

vrrp_script chk_k3s {
   script '/usr/bin/nc -z 127.0.0.1 6443'
   interval 2
   timeout 2
   fall 2
   rise 2
}
vrrp_instance k3s-vip {
   interface eth0
   state MASTER
   priority 200
   virtual_router_id 220
   virtual_ipaddress {
       10.101.150.220/24
   }
  track_script {
       chk_k3s
   }
}

The command 'busybox nc' does not work well with the keepalived, causing the chk_k3s script to fail. Therefore, use netcat-openbsd instead.

Dockerfile:

FROM alpine:3.15.7
LABEL maintainer="[email protected]"

RUN apk add netcat-openbsd=1.130-r3 \
    && apk add keepalived=2.2.4-r2

COPY keepalived.conf /etc/keepalived/keepalived.conf

CMD ["/usr/sbin/keepalived", "-n", "-l", "-f", "/etc/keepalived/keepalived.conf"]

Tag summary

Content type

Image

Digest

sha256:3983d2996…

Size

5.5 MB

Last updated

about 2 years ago

docker pull pioneerm/keepalived:2.2.4-r2