您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这篇文章主要介绍K8S多master中如何部署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
以上是“K8S多master中如何部署Master02”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。