Kubernetes : ノードを追加する2020/08/19 |
既存の Kubernetes クラスターにノードを新規に追加する場合は以下のように設定します。
以下のように 三台のノードで構成している Kubernetes クラスターに [node03.srv.world] ノードを新規に追加します。
-----------+---------------------------+--------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.51 eth0|10.0.0.52 +----------+-----------+ +-----------+----------+ +-----------+----------+ | [ dlp.srv.world ] | | [ node01.srv.world ] | | [ node02.srv.world ] | | Master Node | | Worker Node | | Worker Node | +----------------------+ +----------------------+ +----------------------+ |
[1] |
新規に追加するノードで、こちらを参考に、ノード共通の設定を適用しておきます。
|
[2] | Master ノードで認証トークンを確認します。 |
root@dlp:~# kubeadm token create --print-join-command kubeadm join 10.0.0.30:6443 --token mf7wmw.i6lzmcweb1k5fhan --discovery-token-ca-cert-hash sha256:a2fe3ff26b45163db734448366299b00ab111754ac5cd8f0b941ea4a0ad07e11 |
[3] | 新規に追加するノードで、Master ノードで確認した認証トークン用コマンドを実行します。 |
root@node03:~# kubeadm join 10.0.0.30:6443 --token mf7wmw.i6lzmcweb1k5fhan \ --discovery-token-ca-cert-hash sha256:a2fe3ff26b45163db734448366299b00ab111754ac5cd8f0b941ea4a0ad07e11 W0819 13:43:45.078343 5986 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set. [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 -oyaml' [kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.18" 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] 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] | Master ノードでノード情報を確認しておきます。新規追加ノードが STATUS = Ready であれば OK です。 |
root@dlp:~# kubectl get nodes NAME STATUS ROLES AGE VERSION dlp.srv.world Ready master 135m v1.18.8 node01.srv.world Ready <none> 132m v1.18.8 node02.srv.world Ready <none> 131m v1.18.8 node03.srv.world Ready <none> 3m1s v1.18.8root@dlp:~# kubectl get pods -A -o wide | grep node03 NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES kube-system kube-flannel-ds-amd64-558tf 1/1 Running 0 16m 10.0.0.53 node03.srv.world <none> <none> kube-system kube-proxy-h79c2 1/1 Running 0 16m 10.0.0.53 node03.srv.world <none> <none> |
Sponsored Link |