一、首先在master上生成新的token
代码语言:javascript复制kubeadm token create --print-join-command
kubeadm join 192.168.1.10:6443 --token 42ojpt.z2h5ii9n898tzo36 --discovery-token-ca-cert-hash sha256:7cf14e8cb965d5eb9d66f3707ba20deeadc90bd36b730ce4c0e5d9db80d3625b
二、在master上生成用于新master加入的证书
代码语言:javascript复制kubeadm init phase upload-certs --experimental-upload-certs
[root@master ~]# kubeadm init phase upload-certs --experimental-upload-certs Flag --experimental-upload-certs has been deprecated, use --upload-certs instead W1228 17:15:02.356743 27154 version.go:98] could not fetch a Kubernetes version from the internet: unable to get URL “https://dl.k8s.io/release/stable-1.txt”: Get https://storage.googleapis.com/kubernetes-release/release/stable-1.txt: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) W1228 17:15:02.356872 27154 version.go:99] falling back to the local client version: v1.15.1 [upload-certs] Storing the certificates in Secret “kubeadm-certs” in the “kube-system” Namespace [upload-certs] Using certificate key: e799a655f667fc327ab8c91f4f2541b57b96d2693ab5af96314ebddea7a68526
三、添加新node
kubeadm join 192.168.1.10:6443 --token 42ojpt.z2h5ii9n898tzo36 --discovery-token-ca-cert-hash sha256:7cf14e8cb965d5eb9d66f3707ba20deeadc90bd36b730ce4c0e5d9db80d3625b
四、添加新master,把红色部分加到–experimental-control-plane --certificate-key后。
kubeadm join 192.168.1.10:6443 --token 42ojpt.z2h5ii9n898tzo36 --discovery-token-ca-cert-hash sha256:7cf14e8cb965d5eb9d66f3707ba20deeadc90bd36b730ce4c0e5d9db80d3625b --experimental-control-plane --certificate-key e799a655f667fc327ab8c91f4f2541b57b96d2693ab5af96314ebddea7a68526