Sign inSign up

basefly/keepalived

By basefly

Updated almost 5 years ago

keepalived base on alpine, support arm64 and amd64.

Image
1

529

basefly/keepalived repository overview

quick run with containerd:

nerdctl  run  -d       --name  keepalived --restart always   -v  /etc/keepalived/keepalived.conf:/etc/keepalived/keepalived.conf  --network=host --privileged   basefly/keepalived

keepalived.conf example:

## master
global_defs {
    router_id lb-master
}

vrrp_script check {
    ## example check, please replace it
    script "curl -k https://127.0.0.1:6443/readyz"
    interval 3
    timeout 9
    fall 2
    rise 2
}

vrrp_instance VI-kube-master {
    state MASTER
    priority 120
    unicast_src_ip  {{.Master0}}
    unicast_peer {
      {{.Master1}}
    }
    dont_track_primary
    interface {{.Interface}}
    ## no need
    virtual_router_id 111
    advert_int 3
    track_script {
        check
    }
    virtual_ipaddress {
        {{.Vip}}
    }
}



## backup
global_defs {
    router_id lb-backup-{{.Master1}}
}

vrrp_script check {
    script "curl -k https://127.0.0.1:6443/readyz"
    interval 3
    timeout 9
    fall 2
    rise 2
}

vrrp_instance VI-kube-master {
    state BACKUP
    priority 105
    unicast_src_ip {{.Master1}}
    unicast_peer {
        {{.Master0}}
    }
    dont_track_primary
    interface {{.Interface}}
    ## no need
    virtual_router_id 111
    advert_int 3
    track_script {
        check
    }
    virtual_ipaddress {
        {{.Vip}}
    }
}


Dockerfile:

FROM alpine
RUN apk --no-cache add  keepalived curl

CMD rm  -rf /var/run/keepalived/*  && \
    /usr/sbin/keepalived --dont-fork --log-console  -f /etc/keepalived/keepalived.conf

build image:

docker  buildx  build  -t  basefly/keepalived:v2.2.4   --platform=linux/arm64,linux/amd64  .  --push

Tag summary

Content type

Image

Digest

Size

4 MB

Last updated

almost 5 years ago

docker pull basefly/keepalived