# 以下提示是node(slave)节点执行加入集群的命令(每个部署不一样,根据自己的来)
[root@k8s-node-2 ~]# kubeadm join 192.168.2.21:6443 --token xaaczs.c602kj1bmqwwc59y \
--discovery-token-ca-cert-hash sha256:8469e30868f31db51471d74b0cc7d880fc9f323a15f7b19c1df3004e2e7bf255
# 如下提示信息
[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'
[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] Starting the kubelet
[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.
1.3 Master查看
(3) 等待5分钟左右,master执行如下命令查看slave状态
kubectl get nodes
[root@k8s-master ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
k8s-master Ready control-plane,master 140m v1.23.0
k8s-node-1 Ready <none> 128m v1.23.0
k8s-node-2 Ready <none> 5m31s v1.23.0