Debian 12 bookworm
Sponsored Link

Kubernetes : ノードを追加する2023/07/28

 

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

以下のように 3 台のノードで構成している Kubernetes クラスターに [snode03.srv.world] ノードを新規に追加します。

-----------+---------------------------+--------------------------+------------
           |                           |                          |
       eth0|10.0.0.25              eth0|10.0.0.71             eth0|10.0.0.72
+----------+-----------+   +-----------+-----------+   +-----------+-----------+
|  [ ctrl.srv.world ]  |   |  [snode01.srv.world]  |   |  [snode02.srv.world]  |
|     Control Plane    |   |      Worker Node      |   |      Worker Node      |
+----------------------+   +-----------------------+   +-----------------------+

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

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

[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.
[4] Control Plane ノードでノード情報を確認しておきます。新規追加ノードが STATUS = Ready であれば OK です。
root@ctrl:~#
kubectl get nodes

NAME                STATUS   ROLES           AGE     VERSION
ctrl.srv.world      Ready    control-plane   5h44m   v1.26.6
snode01.srv.world   Ready    <none>          51m     v1.26.6
snode02.srv.world   Ready    <none>          50m     v1.26.6
snode03.srv.world   Ready    <none>          76s     v1.26.6

root@ctrl:~#
kubectl get pods -A -o wide | grep snode03

kube-system   calico-node-b9xkk                         1/1     Running   0          107s    10.0.0.73        snode03.srv.world   <none>           <none>
kube-system   kube-proxy-86p6p                          1/1     Running   0          107s    10.0.0.73        snode03.srv.world   <none>           <none>
関連コンテンツ