CentOS7中在
· One min read
[Unit]
Description=LVS and VRRP High Availability Monitor
After=syslog.target network-online.target
RequiresMountsFor=/data/conf
[Service]
Type=forking
PIDFile=/var/run/keepalived.pid
KillMode=process
EnvironmentFile=-/etc/sysconfig/keepalived
ExecStartPre=/usr/bin/cp -f /data/conf/k8s-nodes-virtual-server.conf /etc/keepalived/conf/k8s-nodes-virtual-server.conf
ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
! Configuration File for keepalived
global_defs {
# notification_email {
# [email protected]
# [email protected]
# [email protected]
# }
# notification_email_from [email protected]
# smtp_server 192.168.200.1
# smtp_connect_timeout 30
router_id LVS_NODE_01
vrrp_skip_check_adv_addr
vrrp_strict
vrrp_garp_interval 0
vrrp_gna_interval 0
}
vrrp_instance VI_K8S_NODE {
state BACKUP
interface eth1
virtual_router_id 81
priority 200
nopreempt
advert_int 1
authentication {
auth_type PASS
auth_pass nOdE*lVs
}
virtual_ipaddress {
10.99.2.14/16 broadcast 10.99.255.255 dev eth1 label eth1:1
}
}
include /etc/keepalived/conf/k8s-nodes-virtual-server.conf
https://www.freedesktop.org/software/systemd/man/systemd.unit.html
