「Kubernetes」- keepalived.conf

  CREATED BY JENKINSBOT

内容简介

在搭建Stacked control plane集群时,应用于keepalived的配置文件。

配置内容

global_defs {
   router_id k8s_lb
}

vrrp_instance VI_1 {
    state MASTER        # 如果是其他节点,修改为“BACKUP”即可
    interface ens33
    virtual_router_id 80
    priority 80         # 其他节点可降低权重
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass just0kk
    }
    virtual_ipaddress {
        10.10.50.100/24 dev ens33
    }
}

virtual_server 10.10.50.100 6443 {
    delay_loop 6
    lb_algo loadbalance
    lb_kind DR
    nat_mask 255.255.255.0
    persistence_timeout 0
    protocol TCP

    real_server 10.10.50.101 6443 {
        weight 1
        SSL_GET {
            url {
              path /healthz
              status_code 200
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    }

    real_server 10.10.50.102 6443 {
        weight 1
        SSL_GET {
            url {
              path /healthz
              status_code 200
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    }

    real_server 10.10.50.103 6443 {
        weight 1
        SSL_GET {
            url {
              path /healthz
              status_code 200
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    }

}