kubeadm添加主从节点

添加master和node节点(使用多master的时候添加)

1、按照上述内容部署kubectl组建

2、首先在master上生成新的token

2.1 为了加入node
[root@k8s-00001 ~]# kubeadm token create --print-join-command
kubeadm join 172.28.149.6:6443 --token km6vem.3zapw7cwe1km7e98 --discovery-token-ca-cert-hash sha256:f5c9d504a850a6de70637270572b0ff6752b0d247b016241b37eefb530aea435 

3、在master上生成用于新master加入的证书

[root@k8s-00001 ~]# kubeadm init phase upload-certs --experimental-upload-certs
unknown flag: --experimental-upload-certs
To see the stack trace of this error execute with --v=5 or higher

解决:之前版本为v1.4.0时该命令正常执行
解决办法:  将–experimental-upload-certs 替换为 --upload-certs
[root@k8s-00001 ~]# kubeadm init phase upload-certs  --upload-certs
[upload-certs] Storing the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace
[upload-certs] Using certificate key:
b7721beec3d4926941a5c243e1c1c4c9124e2b61719e591aa3560d9514fa2de4

4、添加新master,把红色部分加到–experimental-control-plane --certificate-key后。

[root@k8s-00004 ~]#kubeadm join 172.28.149.6:6443 --token km6vem.3zapw7cwe1km7e98 --discovery-token-ca-cert-hash sha256:f5c9d504a850a6de70637270572b0ff6752b0d247b016241b37eefb530aea435 --control-plane --certificate-key b7721beec3d4926941a5c243e1c1c4c9124e2b61719e591aa3560d9514fa2de4

问题:
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
error execution phase preflight:
One or more conditions for hosting a new control plane instance is not satisfied.

unable to add a new control plane instance a cluster that doesn't have a stable controlPlaneEndpoint address

Please ensure that:
* The cluster has a stable controlPlaneEndpoint address.
* The certificates that must be shared among control plane instances are provided.


To see the stack trace of this error execute with --v=5 or higher

5、添加新node

[root@k8s-00005 ~]#kubeadm join 172.28.149.6:6443 --token km6vem.3zapw7cwe1km7e98 --discovery-token-ca-cert-hash sha256:f5c9d504a850a6de70637270572b0ff6752b0d247b016241b37eefb530aea435 

微信公众号,需要的话就关注下我~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值