這篇文章主要介紹K8S多master中如何部署Master02,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括柞水網(wǎng)站建設(shè)、柞水網(wǎng)站制作、柞水網(wǎng)頁(yè)制作以及柞水網(wǎng)絡(luò)營(yíng)銷(xiāo)策劃等。多年來(lái),我們專(zhuān)注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,柞水網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶(hù)以成都為中心已經(jīng)輻射到柞水省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶(hù)的支持與信任!
角色 | 地址 | 安裝組件 |
---|---|---|
master | 192.168.142.220 | kube-apiserver kube-controller-manager kube-scheduler etcd |
master02 | 192.168.142.120 | kube-apiserver kube-controller-manager kube-scheduler |
node1 | 192.168.142.136 | kubelet kube-proxy docker flannel etcd |
node2 | 192.168.142.132 | kubelet kube-proxy docker flannel etcd |
nginx1 | 192.168.142.130 | nginx keepalived |
nginx2 | 192.168.142.140 | nginx keepalived |
分隔符前的操作均在master01上進(jìn)行
復(fù)制kubernetes目錄到master02
[root@master k8s]# scp -r /opt/kubernetes/ root@192.168.142.120:/opt
復(fù)制etcd目錄到master02
master02一定要有etcd證書(shū),否則apiserver服務(wù)無(wú)法啟動(dòng)
[root@master k8s]# scp -r /opt/etcd/ root@192.168.142.120:/opt
kube-apiserver.service kube-controller-manager.service kube-scheduler.service
[root@master k8s]# scp /usr/lib/systemd/system/{kube-apiserver,kube-controller-manager,kube-scheduler}.service root@192.168.142.120:/usr/lib/systemd/system/
實(shí)際上僅需要修改apiserver即可
[root@master02 k8s]# cd /opt/kubernetes/cfg/ [root@master02 cfg]# vim kube-apiserver KUBE_APISERVER_OPTS="--logtostderr=true \ --v=4 \ --etcd-servers=https://192.168.142.220:2379,https://192.168.142.136:2379,https://192.168.142.132:2379 \ #注意地址更改 --bind-address=192.168.142.120 \ --secure-port=6443 \ #注意地址更改 --advertise-address=192.168.142.120 \ --allow-privileged=true \ --service-cluster-ip-range=10.0.0.0/24 \ --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota,NodeRestriction \ --authorization-mode=RBAC,Node \ --kubelet-https=true \ --enable-bootstrap-token-auth \ --token-auth-file=/opt/kubernetes/cfg/token.csv \ --service-node-port-range=30000-50000 \ --tls-cert-file=/opt/kubernetes/ssl/server.pem \ --tls-private-key-file=/opt/kubernetes/ssl/server-key.pem \ --client-ca-file=/opt/kubernetes/ssl/ca.pem \ --service-account-key-file=/opt/kubernetes/ssl/ca-key.pem \ --etcd-cafile=/opt/etcd/ssl/ca.pem \ --etcd-certfile=/opt/etcd/ssl/server.pem \ --etcd-keyfile=/opt/etcd/ssl/server-key.pem"
[root@master02 cfg]# systemctl start kube-apiserver.service [root@master02 cfg]# systemctl start kube-controller-manager.service [root@master02 cfg]# systemctl start kube-scheduler.service
//增加環(huán)境變量 [root@master02 cfg]# vim /etc/profile //末尾添加 export PATH=$PATH:/opt/kubernetes/bin/ [root@master02 cfg]# source /etc/profile //見(jiàn)到如下畫(huà)面即為成功 [root@master02 cfg]# kubectl get node NAME STATUS ROLES AGE VERSION 192.168.142.132 Ready2d12h v1.12.3 192.168.142.136 Ready 38h v1.12.3
以上是“K8S多master中如何部署Master02”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!