49 lines
1.5 KiB
Docker
49 lines
1.5 KiB
Docker
FROM alpine:3.21
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
ARG TARGETPLATFORM
|
|
|
|
LABEL architecture="$TARGETPLATFORM" \
|
|
license="beerware" \
|
|
name="keepalived" \
|
|
summary="Alpine based keepalived container" \
|
|
mantainer="antoinroux@hotmail.fr"
|
|
|
|
RUN apk add --no-cache \
|
|
bash \
|
|
curl \
|
|
keepalived \
|
|
gettext \
|
|
&& addgroup -S keepalived_script \
|
|
&& adduser -S -s /sbin/nologin -G keepalived_script -H keepalived_script
|
|
|
|
ARG KEEPALIVED_EXPORTER_VERSION=1.4.0
|
|
RUN wget -O /usr/local/bin/keepalived-exporter.tar.gz https://github.com/mehdy/keepalived-exporter/releases/download/v${KEEPALIVED_EXPORTER_VERSION}/keepalived-exporter_${KEEPALIVED_EXPORTER_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz && \
|
|
tar -xvf /usr/local/bin/keepalived-exporter.tar.gz -C /usr/local/bin/ keepalived-exporter && \
|
|
rm -f /usr/local/bin/keepalived-exporter.tar.gz
|
|
|
|
ENV STATE=BACKUP
|
|
ENV INTERFACE=enp3s0
|
|
ENV PRIORITY=200
|
|
ENV PASSWORD=""
|
|
ENV SRC_IP=""
|
|
ENV PEER_IP_0=""
|
|
ENV PEER_IP_1=""
|
|
|
|
COPY --chmod=750 --chown=keepalived_script:keepalived_script check_apiserver.sh /usr/lib/keepalived/scripts/chk_kube_apiserver.sh
|
|
COPY keepalived.template.conf /etc/keepalived/keepalived.template.conf
|
|
|
|
COPY --chmod=750 init.sh /
|
|
|
|
ENTRYPOINT ["/init.sh"]
|
|
CMD ["/usr/sbin/keepalived", "--dont-fork", "--log-console"]
|
|
|
|
# Customise keepalived with:
|
|
# args: # override options in the Dockerfile
|
|
# - --vrrp
|
|
# - --log-detail
|
|
# - --dump-conf
|
|
# - --use-file=/etc/keepalived/keepalived.conf
|
|
# CMD ["--vrrp","--log-detail","--dump-conf"]
|