实验环境
Master01:14.0.0.50
Master02:14.0.0.80
Node01: 14.0.0.60
Node02: 14.0.0.70
Nginx01+keepalived:14.0.0.90
Nginx02+keepalived:14.0.0.100
部署master02节点
关闭防火墙,关闭核心防护,关闭网络管理功能(生成环境中一定要关闭它)
[root@localhost ~]# hostnamectl set-hostname master02 #修改主机名
[root@localhost ~]# su
[root@master02 ~]# systemctl stop firewalld #关闭防火墙
[root@master02 ~]# setenforce 0 && sed -i "s/SELINUX=enforcing/SELNIUX=disabled/g" /etc/selinux/config #关闭核心防护
[root@master02 ~]# systemctl stop NetworkManager && systemctl disable NetworkManager #关闭网络管理功能
将master01节点的kubernetes配置文件和启动脚本复制到master02节点
[root@master ~]# scp -r /opt/kubernetes/ root@14.0.0.80:/opt/
[root@master ~]# scp /usr/lib/systemd/system/{
kube-apiserver,kube-controller-manager,kube-scheduler}.service root@14.0.0.80:/usr/lib/systemd/system/
将master01节点的etcd证书复制到master02节点(master02上一定要有etcd证书,用来与etcd通信)
[root@master ~]# scp -r /opt/etcd/ root@14.0.0.80:/opt
master02上修改apiserver配置文件中的IP地址
[root@master02 ~]# cd /opt/kubernetes/cfg/
[root@master02 cfg]# ls
kube-apiserver kube-controller-manager kube-scheduler token.csv
[root@master02 cfg]# vim kube-apiserver
KUBE_APISERVER_OPTS="--logtostderr=true \
--v=4 \
--etcd-servers=https://14.0.0.50:2379,https://14.0.0.60:2379,https://14.0.0.70:2379 \
--bind-address=14.0.0.80 \ #修改此处的绑定IP地址
--secure-port=6443 \
--advertise-address=14.0.0.80 \ #修改此处的IP地址
...省略
启动master02中的三个组件服务
[root@localhost cfg]# systemctl start kube-apiserver.service
[root@localhost cfg]# systemctl start kube-controller-manager.service
[root@localhost cfg]# systemctl start kube-scheduler.service
添加环境变量并查看状态
[root@master02 ~]# echo export PATH=$PATH:/opt/kubernetes/bin >> /etc/profile
[root@master02 ~]# source /etc/profile
[root@master02 ~</