Kubernetes – 安装工作节点4 – 将工作节点连接到主节点

参照初始化主节点时,给出的命令,将工作节点连接到主节点:

kubeadm join 192.168.31.174:6443 --token wzhn5s.lh9ahv8y4f59ie2t \
    --discovery-token-ca-cert-hash sha256:7bf1f8c25fcef4aec3f55e463ac89cf42de43dccacf5fab940a597f0975af492

输出

...

[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.

在主节点执行kubectl get nodes,验证工作节点是否加入:

[root@qikegu-centos5 ~]# kubectl get nodes
NAME             STATUS   ROLES    AGE     VERSION
qikegu-centos5   Ready    master   6h10m   v1.16.2
qikegu-knode1    Ready    <none>   4m3s    v1.16.2

可以看到工作节点qikegu-knode1已经连接到主节点了,主节点和工作节点都处于就绪状态。

类似地,另外一个节点qikegu-knode2,可以按照同样方式安装。

至此,我们已经成功安装Kubernetes,接下来就可以使用Kubernetes了。



浙ICP备17015664号 浙公网安备 33011002012336号 联系我们 网站地图  
@2019 qikegu.com 版权所有,禁止转载