CentOS Stream 9
Sponsored Link

Kubernetes : Worker ノードの設定2023/10/19

 

マルチノード Kubernetes クラスターを構成します。

当例では以下のように 4 台のノードを使用して設定します。

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

事前に全ノードに Kubeadm インストール等々、ノード共通の設定を適用しておきます

[2] Worker ノードとするホストから、Control Plane ノードで初期セットアップしたクラスターに Join します。
Join する際のコマンドは、初期セットアップのコマンド実行時の最後に表示された [kubeadm join ~] コマンドをそのままコピーして実行するのみです。
# Firewalld 稼働中の場合は停止

[root@node01 ~]#
systemctl disable --now firewalld
[root@node01 ~]#
kubeadm join 10.0.0.25:6443 --token yq90qu.cl827hpp06az8isd \
--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...

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.
# This node has joined the cluster と表示されれば OK

[3] Manager ノード または クラスター管理ユーザーを設定したクライアントホストで、ノード情報を確認しておきます。全て STATUS = Ready であれば OK です。
[root@mgr ~]#
kubectl get nodes

NAME               STATUS   ROLES           AGE    VERSION
dlp.srv.world      Ready    control-plane   65m    v1.28.2
node01.srv.world   Ready    <none>          2m1s   v1.28.2
node02.srv.world   Ready    <none>          28s    v1.28.2
関連コンテンツ