CentOS Stream 9
Sponsored Link

Kubernetes : Add Worker Nodes2023/10/19

 

Add new Worker Nodes to existing Kubernetes Cluster.

This example is based on the cluster environment like follows.
It adds [node03.srv.world (10.0.0.53)] as Worker Node to this cluster.

+----------------------+   +----------------------+
|   [ mgr.srv.world ]  |   |   [ dlp.srv.world ]  |
|     Manager Node     |   |     Control Plane    |
+-----------+----------+   +-----------+----------+
        eth0|10.0.0.25             eth0|10.0.0.30
            |                          |
------------+--------------------------+-----------
            |                          |
        eth0|10.0.0.51             eth0|10.0.0.52
+-----------+----------+   +-----------+----------+
| [ node01.srv.world ] |   | [ node02.srv.world ] |
|     Worker Node#1    |   |     Worker Node#2    |
+----------------------+   +----------------------+

[1]

On a new Node, Configure common settings to join in Cluster, refer to here.

[2] Confirm join command on Control Plane Node.
[root@dlp ~]#
kubeadm token create --print-join-command

kubeadm join 10.0.0.25:6443 --token 5f90le.v0jciitymf7j19jl --discovery-token-ca-cert-hash sha256:8a8bd725c9cbf8d03c0a724bded0afb923a067d48ca50fd8f0346fd3d0a27b6e
[3] Run join command on a new Node.
# if Firewalld is running, disable it

[root@node03 ~]#
systemctl disable --now firewalld
[root@node03 ~]#
kubeadm join 10.0.0.25:6443 --token 5f90le.v0jciitymf7j19jl \
--discovery-token-ca-cert-hash sha256:8a8bd725c9cbf8d03c0a724bded0afb923a067d48ca50fd8f0346fd3d0a27b6e

[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...
[  432.883160] Warning: Deprecated Driver is detected: iptables will not be maintained in a future major release and may be disabled
[  432.921296] Warning: Deprecated Driver is detected: ip6tables will not be maintained in a future major release and may be disabled

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.
[4] Verify settings on Manager Node. That's OK if the status of new Node turns to [STATUS = Ready].
[root@mgr ~]#
kubectl get nodes

NAME               STATUS   ROLES           AGE    VERSION
dlp-1.srv.world    Ready    control-plane   22m    v1.28.2
dlp.srv.world      Ready    control-plane   4h4m   v1.28.2
node01.srv.world   Ready    <none>          3h     v1.28.2
node02.srv.world   Ready    <none>          178m   v1.28.2
node03.srv.world   Ready    <none>          95s    v1.28.2

[root@mgr ~]#
kubectl get pods -A -o wide | grep node03

kube-system            calico-node-fqf2f                            1/1     Running   0             2m55s   10.0.0.53         node03.srv.world   <none>           <none>
kube-system            kube-proxy-rlcbx                             1/1     Running   0             2m55s   10.0.0.53         node03.srv.world   <none>           <none>
Matched Content