コンテンツにスキップ

Control Plane Node への Pod デプロイ方法

通常、Kubernetes では Control Plane Node(マスター ノード)はクラスター管理専用として扱われ、node-role.kubernetes.io/master:NoSchedule という taint により Pod のスケジューリング対象から除外されています。これにより、ワーカーノード以外のノードで不要な負荷が発生するのを防ぐ設計になっています。

しかし特定の運用上の理由や検証環境などで、Control Plane Node にも Pod をデプロイしたいケースがあります。
その方法として「taints の削除」と「Pod の tolerations 設定」という 2 つのアプローチを解説します。

Control Plane Node の taints 削除

Node の taints から削除する方法です。
これを行うことで、全ての Pod が配置可能となります。

taint 削除

Terminal window
kubectl taint nodes master-node node-role.kubernetes.io/master:NoSchedule-

taint 付与

設定を戻すには、以下のように taint を再設定します。

Terminal window
kubectl taint nodes master-node node-role.kubernetes.io/master:NoSchedule

Pod の tolerations 追加

一部の Pod のみ Control Plane Node に配置したい場合は、tolerations 設定を追加します。

PodSpec に以下の設定を追加します。

spec:
tolerations:
- key: "node-role.kubernetes.io/master"
effect: "NoSchedule"
operator: "Equal"