接上一篇单节点部署(1)部署多节点
负载均衡
Nginx1:192.168.13.128/24
Nginx2:192.168.13.129/24
Master节点
master1:192.168.13.131/24 kube-apiserver kube-controller-manager kube-scheduler etcd
master2:192.168.13.130/24 kube-apiserver kube-controller-manager kube-scheduler etcd
Node节点
node1:192.168.13.132/24 kubelet kube-proxy docker flannel etcd
node2:192.168.13.133/24 kubelet kube-proxy docker flannel etcd
[root@master02 ~]# systemctl stop firewalld.service
[root@master02 ~]# setenforce 0
[root@master01 k8s]# scp -r /opt/kubernetes/ root@192.168.13.130:/opt
##复制kubernetes目录到master02
[root@master01 k8s]# scp /usr/lib/systemd/system/{kube-apiserver,kube-controller-manager,kube-scheduler}.service root@192.168.13.130:/usr/lib/systemd/system/
##复制master中的三个组件启动脚本
[root@master02 ~]# cd /opt/kubernetes/cfg/
[root@master02 cfg]# vim kube-apiserve ##修改apiserver配置文件
--bind-address=192.168.13.130 \ ##修改地址
--secure-port=6443 \
--advertise-address=192.168.13.130 \ ##修改地址
[root@master01 k8s]# scp -r /opt/etcd/ root@192.168.13.130:/opt/
##在master02中操作
[root@master02 cfg]# systemctl start kube-apiserver.service ##开启服务
[root@master02 cfg]# systemctl enable kube-apiserver.service
[root@master02 cfg]# systemctl start kube-controller-manager.service
[root@master02 cfg]# systemctl enable kube-controller-manager.service
[root@master02 cfg]# systemctl start kube-scheduler.service
[root@master02 cfg]# systemctl enable 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.13.132 Ready <none> 75m v1.12.3
192.168.13.133 Ready <none> 55m v1.12.3
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。