Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
// 执行此处的三条命令
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
//
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
// 保存以下内容
kubeadm join 192.168.64.30:6443 --token 53hny9.t50ty38a9nx4uvrn \
--discovery-token-ca-cert-hash sha256:b1ab7e7e93f927da681afb1808a3636f86a96d05b455192f4825df2d8b92e56c
[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.
如需要添加多个节点, 重复上面步骤即可
回到主节点查看Worker节点的状态
kubectl get nodes
NAME STATUS ROLES AGE VERSION
192.168.64.30 NotReady control-plane,master 19m v1.20.4
192.168.64.31 NotReady <none> 38s v1.20.4
kubectl get pod -n kubernetes-dashboard
NAME READY STATUS RESTARTS AGE
dashboard-metrics-scraper-79c5968bdc-kjwvz 1/1 Running 0 3m59s
kubernetes-dashboard-86bc9d74f9-h4mfz 1/1 Running 0 3m59s