您好,登錄后才能下訂單哦!
這篇文章為大家分享有關在kubernetes中配置Master02的方法。文章涵蓋Master02的配置和使用方法,希望大家通過這篇文章能有所收獲。
角色 | 地址 | 安裝組件 |
---|---|---|
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上進行
復制kubernetes目錄到master02
[root@master k8s]# scp -r /opt/kubernetes/ root@192.168.142.120:/opt
復制etcd目錄到master02
master02一定要有etcd證書,否則apiserver服務無法啟動
[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/
實際上僅需要修改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
//增加環境變量
[root@master02 cfg]# vim /etc/profile
//末尾添加
export PATH=$PATH:/opt/kubernetes/bin/
[root@master02 cfg]# source /etc/profile
//見到如下畫面即為成功
[root@master02 cfg]# kubectl get node
NAME STATUS ROLES AGE VERSION
192.168.142.132 Ready <none> 2d12h v1.12.3
192.168.142.136 Ready <none> 38h v1.12.3
看完這篇文章,你們學會kubernetes中配置Master02的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。