openSUSE Leap 16

Kubernetes : Worker ノードを追加する2025/11/07

 

既存の Kubernetes クラスターに Worker ノードを新規に追加する場合は以下のように設定します。

当例では以下のように 4 台のノードを使用してクラスターを構成しています。
ここへ、新たに [node03.srv.world (10.0.0.53)] を Worker ノードとして追加します。

+----------------------+   +----------------------+
|  [ ctrl.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]

新規に追加するノードで、こちらを参考に、ノード共通の設定を適用しておきます

[2] Control Plane ノードで認証トークンを確認します。
dlp:~ #
kubeadm token create --print-join-command

kubeadm join 10.0.0.25:6443 --token nlbemc.8yvfk6o5bgnilk7z --discovery-token-ca-cert-hash sha256:fbbf173149bc275b687e3a772b81d2e127cbbcd49a5546902e1a99f7e37d4729
[3] 新規に追加するノードで、Control Plane ノードで確認した認証トークン用コマンドを実行します。
node03:~ #
kubeadm join 10.0.0.25:6443 --token nlbemc.8yvfk6o5bgnilk7z \
--discovery-token-ca-cert-hash sha256:fbbf173149bc275b687e3a772b81d2e127cbbcd49a5546902e1a99f7e37d4729

[preflight] Running pre-flight checks
[preflight] Reading configuration from the "kubeadm-config" ConfigMap in namespace "kube-system"...
[preflight] Use 'kubeadm init phase upload-config kubeadm --config your-config-file' to re-upload it.
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/instance-config.yaml"
[patches] Applied patch of type "application/strategic-merge-patch+json" to target "kubeletconfiguration"
[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-check] Waiting for a healthy kubelet at http://127.0.0.1:10248/healthz. This can take up to 4m0s
[kubelet-check] The kubelet is healthy after 501.625289ms
[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.
[4] Manager ノードでノード情報を確認しておきます。新規追加ノードが STATUS = Ready であれば OK です。
ctrl:~ #
kubectl get nodes

NAME               STATUS   ROLES           AGE     VERSION
dlp-1.srv.world    Ready    control-plane   9m29s   v1.34.1
dlp.srv.world      Ready    control-plane   75m     v1.34.1
node01.srv.world   Ready    <none>          66m     v1.34.1
node02.srv.world   Ready    <none>          62m     v1.34.1
node03.srv.world   Ready    <none>          40s     v1.34.1

ctrl:~ #
kubectl get pods -A -o wide | grep node03

calico-system          calico-node-lnwf8                                       1/1     Running   0             85s   10.0.0.53         node03.srv.world   <none>           <none>
calico-system          calico-typha-74974cccd8-vffxr                           1/1     Running   0             79s   10.0.0.53         node03.srv.world   <none>           <none>
calico-system          csi-node-driver-6h6r2                                   2/2     Running   0             85s   192.168.127.65    node03.srv.world   <none>           <none>
kube-system            kube-proxy-4n2dh                                        1/1     Running   0             84s   10.0.0.53         node03.srv.world   <none>           <none>
関連コンテンツ