$ vi /etc/keepalived/keepalived.conf>>global_defs {router_id LVS_DEVEL}vrrp_script chk_apiserver {script "/etc/keepalived/check_apiserver.sh"interval 2weight-5fall3rise2}vrrp_instance VI_1{stateMASTER # 一主(MASTER)两从(BACKUP)interfaceens33mcast_src_ip192.168.2.200 #所在主机IP 192.168.2.200、192.168.2.201、192.168.2.202virtual_router_id51priority100# 需修改100、101、102advert_int2authentication {auth_typePASSauth_passK8S}virtual_ipaddress {192.168.2.205}#track_script {#chk_apiserver# }}
# k8s-master01、k8s-master02、k8s-master03配置健康检查$ vi /etc/keepalived/check_apiserver.sh>># !/bin/basherr=0for k in $(seq 1 5)docheck_code=$(pgrep kube-apiserver)if [[ $check_code == "" ]]; thenerr=$(expr $err + 1)sleep 5continueelseerr=0breakfidoneif [[ $err != "0" ]]; thenecho "systemctl stop keepalived"/usr/bin/systemctl stop keepalivedexit 1elseexit 0fi
# 启动haproxy和keepalivedsystemctl enable --now haproxysystemctl enable --now keepalived
Kubeadm集群初始化# 只有master01和初始化的时候才使用$ vi kubeadm-config.yaml
【Kubernetes集群】
推荐阅读
- 5 个重要的 Kubernetes 概念让学习变得简单
- kubernetes之基于ServiceAccount拉取私有镜像
- Redis集群原理与容器化部署
- minio集群将一切访问都交给nginx
- 「开源精品」 C# im 聊天通讯架构 FreeIM 支持集群、职责分明、高性能
- kubernetes-traefik的安装和部署
- 扩展你的KUBECTL功能
- 集群效应是什么意思 集群效应
- 为什么有人认为现在正处于第六次生物集群灭绝?