node節點服務器需要安裝好 kubeadm, kubelet 和 kubectl:
使用kubeadm join 命令即行,使用master節點kebeadm init時的提示:
root@boke-node:~# kubeadm join 192.168.17.180:6443 --token abcdef.0123456789abcdef \ > --discovery-token-ca-cert-hash sha256:ea37964dc96f76f3e658b27ffdc220f60ced82de387aafd8effafe9618f5e6cb [preflight] Running pre-flight checks [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ [preflight] Reading configuration from the cluster... [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml' [kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.16" ConfigMap in the kube-system namespace [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Activating the kubelet service [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap... This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details. Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
master節點使用kubectl get nodes命令查看是否添加成功
kubectl get nodes
# 打印出node節點便代表成功了 NAME是根據主機名來定義的
NAME STATUS ROLES AGE VERSION boke-master Ready master 104m v1.16.2 boke-node Ready <none> 103s v1.16.2