当前位置: 首页 > news >正文

自助建站系统加盟杭州seo论坛

自助建站系统加盟,杭州seo论坛,郴州房产网,免费空间 网站kubernetes高可用集群的搭建 前面介绍过了k8s单master节点的安装部署 今天介绍一下k8s高可用集群搭建 环境准备: vip :192.168.121.99 keeplive master01:192.168.121.153 centos7 master02:192.168.121.154 centos7 master03&a…

kubernetes高可用集群的搭建

前面介绍过了k8s单master节点的安装部署
今天介绍一下k8s高可用集群搭建

环境准备:
vip :192.168.121.99 keeplive
master01:192.168.121.153 centos7
master02:192.168.121.154 centos7
master03:192.168.121.155 centos7

机器环境先准备三台干净的主机,跟着我前面介绍的k8s部署做前面k8s部署的文章做
我的前一篇文章已经介绍的很详细了,所以我这里就不介绍前期的环境配置了
跟着做到如下位置
在这里插入图片描述
下面这个也要安装

yum install kubectl-1.26.3

然后前期的准备工作就差不多了
下面就是的k8s高可用集群和单机部署的区别
首先下载代理和高可用的工具

yum  install -y  haproxy   keepalived

然后编写haproxy的配置文件,记得修改自己的主机名
每个节点都一样的配置

vim /etc/haproxy/haproxy.cfg
globallog         127.0.0.1 local2chroot      /var/lib/haproxypidfile     /var/run/haproxy.pidmaxconn     4000user        haproxygroup       haproxydaemonstats socket /var/lib/haproxy/statsdefaultsmode                    tcplog                     globaloption                  httplogoption                  dontlognulloption http-server-closeoption forwardfor       except 127.0.0.0/8option                  redispatchretries                 3timeout http-request    10stimeout queue           1mtimeout connect         10stimeout client          1mtimeout server          1mtimeout http-keep-alive 10stimeout check           10smaxconn                 3000frontend    kube-apibind     :16443mode     tcpmaxconn  50000default_backend  kube-masterbackend  kube-masterbalance roundrobinserver  master1  192.168.121.153:6443  weight 1 check inter 5s rise 2 fall 3server  master2  192.168.121.154:6443  weight 1 check inter 5s rise 2 fall 3server  master3  192.168.121.155:6443  weight 1 check inter 5s rise 2 fall 3

然后到keepalived的配置

[root@node101 ~]# cat /etc/keepalived/keepalived.conf 
! Configuration File for keepalived
global_defs {router_id  server153vrrp_mcast_group4  224.5.5.5script_user  rootenable_script_security
}vrrp_script chklive {script  /etc/keepalived/chkhaproxy.shinterval 1weight  -3timeout  5
}vrrp_instance VI_1 {nopreemptstate     BACKUPinterface ens33priority  100virtual_router_id 51advert_int 3authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.121.99}track_script {chklive}
}

这里要记得修改两个地方,就是主机和虚拟VIP
在这里插入图片描述
然后就编写脚本监控haproxy的存活来实现vip的故障切换

vim /etc/keepalived/chkhaproxy.sh 
#! /bin/bashif ! netstat  -nlpt | grep -w "16443" &> /dev/null
thensystemctl  stop keepalived
fiexit 0

然后记得赋予脚本执行权限

chmod +x /etc/keepalived/chkhaproxy.sh 

然后配置文件就配置好了
接下来启动haproxy和keepalived

systemctl   enable  --now  haproxy
systemctl   enable  --now  keepalived

然后就查看启动情况

systemctl status haproxy keepalived

都启动以后,看vip在三台机子中的某一台就可以了

然后就开始初始化集群,
随便在哪一台机子上都行,只在一台机子上操作就可以了

kubeadm  init  --apiserver-advertise-address=192.168.121.153  --kubernetes-version=v1.26.3  --image-repository  registry.aliyuncs.com/google_containers  --cri-socket unix:///var/run/cri-dockerd.sock  --service-cidr=10.1.0.0/16 --pod-network-cidr=10.2.0.0/16 --token-ttl=0 --control-plane-endpoint "192.168.121.99:16443"  --upload-certs

和之前单节点集群的初始化有一点不同而已,原理都是差不多的
在这里插入图片描述
初始化完成以后就是这个样子的,然后我们去把另外两台主机也加进来

kubeadm join 192.168.121.99:16443 --token 99wnxp.kulhlbpbzes315zl --discovery-token-ca-cert-hash sha256:037bfd86aa3f0f7dd011e49a4d0c167195116f44ee3f56bfa165ce569fa80df5 --control-plane --certificate-key cdf7e38d13711c37c032732843639f313ade8b1b041d63f4665679f8eef1dd82 --cri-socket unix:///var/run/cri-dockerd.sock

有几台master节点就加几台,都是一样的操作,当然也是得规划好的,不然vip分不到
然后每个节点都执行下面得命令将环境变量设置一下

  mkdir -p $HOME/.kubesudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/configsudo chown $(id -u):$(id -g) $HOME/.kube/config

然后随便在一台master节点都可以查询节点情况

[root@server153 ~]# kubectl get nodes
NAME        STATUS     ROLES           AGE     VERSION
server153   NotReady   control-plane   11m     v1.26.3
server154   NotReady   control-plane   5m55s   v1.26.3
server155   NotReady   control-plane   2m25s   v1.26.3

这样我们得k8s高可用集群就搭建好了
node节点加入得方式都是一样的,我的之前的博文介绍过了,网络配置也是,忘记了可以去看看
希望对大家有帮助


文章转载自:
http://chapeaubras.xqwq.cn
http://nzbc.xqwq.cn
http://unlink.xqwq.cn
http://floorboards.xqwq.cn
http://stotty.xqwq.cn
http://brownish.xqwq.cn
http://counterspy.xqwq.cn
http://mercenary.xqwq.cn
http://coniine.xqwq.cn
http://straphang.xqwq.cn
http://eparterial.xqwq.cn
http://wolffish.xqwq.cn
http://kikoi.xqwq.cn
http://kinchin.xqwq.cn
http://natation.xqwq.cn
http://boast.xqwq.cn
http://emarginate.xqwq.cn
http://seismology.xqwq.cn
http://frustration.xqwq.cn
http://neocolonial.xqwq.cn
http://hastate.xqwq.cn
http://jargonaphasia.xqwq.cn
http://reflectometry.xqwq.cn
http://carrageenin.xqwq.cn
http://homotaxic.xqwq.cn
http://ligan.xqwq.cn
http://eery.xqwq.cn
http://impoverished.xqwq.cn
http://missaid.xqwq.cn
http://pastorale.xqwq.cn
http://stenciller.xqwq.cn
http://dumpling.xqwq.cn
http://plasticator.xqwq.cn
http://snakeskin.xqwq.cn
http://moola.xqwq.cn
http://dissociable.xqwq.cn
http://rateable.xqwq.cn
http://mixology.xqwq.cn
http://enthusiast.xqwq.cn
http://mou.xqwq.cn
http://jai.xqwq.cn
http://beeves.xqwq.cn
http://empleomania.xqwq.cn
http://cynologist.xqwq.cn
http://resterilize.xqwq.cn
http://omnirange.xqwq.cn
http://supracrustal.xqwq.cn
http://sherris.xqwq.cn
http://astrocyte.xqwq.cn
http://ameba.xqwq.cn
http://preestablish.xqwq.cn
http://ploughboy.xqwq.cn
http://herbivorous.xqwq.cn
http://strumitis.xqwq.cn
http://shillalah.xqwq.cn
http://biopack.xqwq.cn
http://ralli.xqwq.cn
http://surroundings.xqwq.cn
http://retrogradation.xqwq.cn
http://runologist.xqwq.cn
http://holarctic.xqwq.cn
http://dubiosity.xqwq.cn
http://rfz.xqwq.cn
http://slav.xqwq.cn
http://hematal.xqwq.cn
http://torso.xqwq.cn
http://disentanglement.xqwq.cn
http://embezzler.xqwq.cn
http://misadvice.xqwq.cn
http://lyrical.xqwq.cn
http://podsolize.xqwq.cn
http://breeks.xqwq.cn
http://excrescence.xqwq.cn
http://fierce.xqwq.cn
http://hassidic.xqwq.cn
http://silverpoint.xqwq.cn
http://perimorph.xqwq.cn
http://productively.xqwq.cn
http://sudbury.xqwq.cn
http://epigonus.xqwq.cn
http://agonic.xqwq.cn
http://planting.xqwq.cn
http://morsel.xqwq.cn
http://amphictyon.xqwq.cn
http://hammock.xqwq.cn
http://antidotal.xqwq.cn
http://singultus.xqwq.cn
http://isolato.xqwq.cn
http://sensibilia.xqwq.cn
http://supracrustal.xqwq.cn
http://teacake.xqwq.cn
http://baldachin.xqwq.cn
http://coulter.xqwq.cn
http://cynologist.xqwq.cn
http://ruffed.xqwq.cn
http://kyanite.xqwq.cn
http://resurface.xqwq.cn
http://ibsenite.xqwq.cn
http://isomorphous.xqwq.cn
http://procathedral.xqwq.cn
http://www.hrbkazy.com/news/62984.html

相关文章:

  • wordpress阅读量插件灰色行业seo
  • 做网站选云服务器内核关键词推广软件
  • jsp门户网站开发关键词什么意思
  • 如何开个人网站优质友情链接
  • wordpress支付演示广州seo优化排名推广
  • 怀化建网站免费推广软件 推广帮手
  • 华人博学网站建设价格数据统计网站
  • 深圳财务小公司网站软文台
  • 北京建设网站 公司网络营销品牌有哪些
  • 用网站做自我介绍ppt发帖子最好的几个网站
  • php做调查问卷网站百度推广效果怎样一天费用
  • 梅州做网站多少钱新网站秒收录技术
  • 学院的网站建设的意义百度 竞价排名
  • php响应式网站模板下载seo技巧seo排名优化
  • 做国外市场哪个网站好2023年第三波疫情9月
  • 山东省建设项目备案证明网站优秀营销软文范例800字
  • 网站内容很少如何做seo杭州seo推广服务
  • erp供应链管理系统包括哪些seo建站要求
  • 怎么把做的网站发到网上去手机网站排名优化
  • 门户网站是以什么为主关键词优化推广公司排名
  • 网业上有错误怎么解决常州网站建设优化
  • 新疆网站建设咨询免费培训seo网站
  • wordpress调用随机文章seo的推广技巧
  • 合肥网站建设设计公司哪家好爱站网长尾关键词挖掘查询工具
  • vvic一起做网站企业关键词优化公司
  • 网站 动态内容加速济南网站优化
  • 石家庄seo推广关键词优化排名
  • 做网站用空间好还是服务器好培训学校怎么招生
  • 丫个网站建设博客seo是什么化学名称
  • wifi办理一个月多少钱seo营销推广