1. 程式人生 > 其它 >20220213 使用kubeasz搭建高可用kubernets

20220213 使用kubeasz搭建高可用kubernets

一、基礎環境準備
1.伺服器

主機ip地址 角色 作業系統 配置
192.168.1.34 master01 centos7.8 4c8g
192.168.1.36 master02 centos7.8 4c8g
192.168.1.37 master03 centos7.8 4c8g
192.168.1.69 etcd01 centos7.8 2c2g
192.168.1.70 etcd02 centos7.8 2c2g
192.168.1.71 etcd03 centos7.8 2c2g
192.168.1.72 node01 centos7.8 2c4g
192.168.1.73 node02 centos7.8 2c4g
192.168.1.74 node03 centos7.8 2c4g
192.168.1.75 haproxy01 centos7.8 1c2g
192.168.1.76 haproxt02 centos7.8 1c2g

2.搭建高可用haproxy
2.1 安裝keepalived
192.168.1.75/76
yum install -y keepalived
75 keepalived.conf配置

點選檢視程式碼
! 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_DEVEL
   vrrp_skip_check_adv_addr
   #vrrp_strict
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.1.198 dev eth0 label eth0:1
    }
}

76 keepalived.conf配置

點選檢視程式碼
! 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_DEVEL
   vrrp_skip_check_adv_addr
   #vrrp_strict
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 51
    priority 80
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
	192.168.1.198 dev eth0 label eth0:1
    }
}