1. 说明

 kube-scheduler

kube-controller-manager 已经做了选举,默认为高可用,所以只要做api-server的高可用即可

5.png

6.png

操作步骤:

scp  /usr/lib/systemd/system/{kube-apiserver,kube-scheduler,kube-controller-manager}.service   192.168.56.13:/usr/lib/systemd/system/
scp -r  /opt/kubernetes    192.168.56.13:/opt/

在新的master节点(192.168.56.13)修改api-server的地址

cd /opt/kubernetes/cfg

下面两个地址改为api-server服务器的地址

--bind-address=192.168.56.13 
--advertise-address=192.168.56.13


然后在192.168.56.13 重启三个服务

systemctl  start  kube-controller-manager
systemctl  start  kube-scheduler
systemctl  start  kube-apiserver


测试: 完全ok

[root@localhost cfg]# vim kube-apiserver 
[root@localhost cfg]# kubectl  get  node 
NAME            STATUS    ROLES     AGE       VERSION
192.168.56.11   Ready     <none>    21d       v1.9.0
192.168.56.12   Ready     <none>    21d       v1.9.0
[root@localhost cfg]# kubectl  get  svc
NAME                TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
glusterfs-cluster   ClusterIP   10.10.10.42    <none>        1/TCP            6d
httpd               ClusterIP   10.10.10.113   <none>        80/TCP           13d
kubernetes          ClusterIP   10.10.10.1     <none>        443/TCP          21d
my-service          ClusterIP   10.10.10.120   <none>        80/TCP,443/TCP   14d
nginx               ClusterIP   10.10.10.164   <none>        80/TCP           13d
nginx-service       NodePort    10.10.10.84    <none>        88:36741/TCP     21d
nginx-service-gf    NodePort    10.10.10.23    <none>        80:34973/TCP     6d
nginx-service-nfs   NodePort    10.10.10.123   <none>        90:40619/TCP     6d
testdns             ClusterIP   10.10.10.53    <none>        80/TCP,443/TCP   13d
[root@localhost cfg]# kubectl  get  ep
NAME                ENDPOINTS                                                      AGE
glusterfs-cluster   192.168.56.11:1,192.168.56.12:1                                6d
httpd               172.17.20.8:80                                                 13d
kubernetes          192.168.56.10:6443                                             21d
my-service          172.17.20.11:443,172.17.9.3:443,172.17.20.11:443 + 1 more...   14d
nginx               172.17.9.5:80                                                  13d
nginx-service       172.17.9.5:80                                                  21d
nginx-service-gf    172.17.20.3:80,172.17.20.4:80,172.17.9.8:80                    6d
nginx-service-nfs   172.17.20.6:80,172.17.9.6:80                                   6d
testdns             172.17.20.11:443,172.17.9.3:443,172.17.20.11:443 + 1 more...   13d
[root@localhost cfg]#