目录

在 Master 节点创建加入节点用的 Token

kubeadm token create --print-join-command
W1106 05:52:12.234596 1947512 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
kubeadm join 172.16.33.157:6443 --token xxx.yyyyyy     --discovery-token-ca-cert-hash sha256:zzzzzzzzzzzzzzzzzzzzzz

Worker 节点登录 root 用户

su - root

一键安装

apt-get install -y kubelet=1.18.3-00 kubeadm=1.18.3-00 kubectl=1.18.3-00

拉取 Worker 节点需要的基础镜像

kube_proxy_v=v1.18.3
docker pull kubesphere/kube-proxy:${kube_proxy_v}
docker tag kubesphere/kube-proxy:${kube_proxy_v} k8s.gcr.io/kube-proxy:${kube_proxy_v}
docker rmi kubesphere/kube-proxy:${kube_proxy_v}

pause_v=3.2
docker pull kubesphere/pause:${pause_v}
docker tag kubesphere/pause:${pause_v} k8s.gcr.io/pause:${pause_v}
docker rmi kubesphere/pause:${pause_v}

docker pull weaveworks/weave-kube:2.6.5
docker pull weaveworks/weave-npc:2.6.5

加入集群(命令来源于上面的 Master 节点)

kubeadm join 172.16.33.157:6443 --token xxx.yyyyyy     --discovery-token-ca-cert-hash sha256:zzzzzzzzzzzzzzzzzzzzzz

查看 Worker 节点的问题

journalctl -xe

在 Master 节点查看集群的状态

$ kubectl get nodes
NAME   STATUS   ROLES    AGE     VERSION
gpu1   Ready    <none>   3h15m   v1.18.3
gpu2   Ready    <none>   3h8m    v1.18.3
ln1    Ready    master   143d    v1.18.3
ln2    Ready    <none>   143d    v1.18.3
ln3    Ready    <none>   143d    v1.18.3

参考资料