informatica:linux:keepalived
This is an old revision of the document!
−Table of Contents
Keepalived
ha high availability redundancy failover
Aplicacion para proveer de Alta Disponibilidad a dos servidores, que compartiran una direccion IP. Uno sera el activo y los demás pasivos.
Fuente: https://github.com/kubernetes/kubeadm/blob/master/docs/ha-considerations.md#keepalived-configuration
Requisitos
- Dos o más servidores que tengan una IP en la misma subred. Funciona con IPs públicas.
Instalacion
sudo apt-get update && sudo apt-get install -y keepalived
Configuración
En este ejemplo la IP flotante será '8.8.8.8'.
Master
1. Crear archivo:
sudo vim /etc/keepalived/keepalived.conf
Con el siguiente contenido:
! /etc/keepalived/keepalived.conf ! Configuration File for keepalived global_defs { router_id LVS_DEVEL } vrrp_script check_apiserver { script "/etc/keepalived/check_apiserver.sh" interval 3 weight -2 fall 10 rise 2 } vrrp_instance VI_1 { state MASTER interface eth0 virtual_router_id 51 priority 101 authentication { auth_type PASS auth_pass k8s } virtual_ipaddress { 45.150.187.221 } track_script { check_apiserver } }
Comentarios:
${STATE} is MASTER for one and BACKUP for all other hosts, hence the virtual IP will initially be assigned to the MASTER. ${INTERFACE} is the network interface taking part in the negotiation of the virtual IP, e.g. eth0. ${ROUTER_ID} should be the same for all keepalived cluster hosts while unique amongst all clusters in the same subnet. Many distros pre-configure its value to 51. ${PRIORITY} should be higher on the control plane node than on the backups. Hence 101 and 100 respectively will suffice. ${AUTH_PASS} should be the same for all keepalived cluster hosts, e.g. 42 ${APISERVER_VIP} is the virtual IP address negotiated between the keepalived cluster hosts.
informatica/linux/keepalived.1622719617.txt.gz · Last modified: 2021/06/03 11:26 by javi