バージョン 1.26 以降の GKE on Azure では、ノードのグレースフル シャットダウンが自動的に有効になります。この機能は、ノードのシャットダウンにおける Pod の適切な終了を管理します。適切な終了により、Pod は状態を保存し、ノードをシャットダウンする前にリソースを解放します。Pod を終了するこの方法により、データ損失のリスクを最小限に抑えることができます。また、シャットダウンされる Pod に依存する、またはそれらとやり取りしている他の Pod やサービスの中断のリスクも最小限に抑えることで、クラスタの復元力を高めることができます。
仕組み
ノードは、定期メンテナンス、ノードのスケーリング、ハードウェアの問題などのイベントによってシャットダウンします。kubelet コンポーネントは、そのイベントを検出し、一定の期間システムのシャットダウンを遅らせるように systemd へ指示することで、ノードの適切な終了プロセスを開始します。この遅延により、ノード上で実行されている Pod をドレインして強制排除する時間ができます。
ノードを適切に終了させる目的は、ノードがシャットダウンする前に非システム Pod と重要なシステム Pod を適切に終了することで、次のデフォルト設定が使用されます。
ShutdownGracePeriod: 30 秒
ShutdownGracePeriodCriticalPods: 15 秒
これらの設定により、非システム Pod では強制的に停止される前に、適切に終了するための 15 秒の猶予が与えられます。重要なシステム Pod では非システム Pod が終了した後さらに 15 秒の猶予が得られます。ただし、この機能はベスト エフォート型で動作するため、指定された 30 秒間ではノードが適切にシャットダウンされない可能性があります。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[],[],null,["# Graceful node shutdown in GKE on Azure\n======================================\n\nStarting from version 1.26, GKE on Azure automatically enables\n[Graceful Node Shutdown](https://kubernetes.io/blog/2021/04/21/graceful-node-shutdown-beta).\nThis feature manages the graceful termination of Pods during node shutdowns.\nGraceful termination lets Pods save their state, and release resources before\nthe node is shut down. This method of terminating Pods minimizes the risk of\ndata loss. It also minimizes the risk of interruptions to other Pods and\nservices that rely on or interact with the Pods being shut down, thus enhancing\nthe resilience of your clusters.\n\nHow it works\n------------\n\nAn event such as scheduled maintenance, node scaling, or a hardware issue,\ntriggers a node shutdown. The `kubelet` component detects the event and\ninitiates the graceful node termination process by instructing `systemd` to\ndelay the system shutdown for a specified duration. This delay gives the node\ntime to drain and evict the Pods running on it.\n\nThe goal of graceful node termination is to gracefully terminate both non-system\nand critical system Pods before the node shuts down. The following default\nsettings are used:\n\n- `ShutdownGracePeriod`: 30 seconds\n- `ShutdownGracePeriodCriticalPods`: 15 seconds\n\nThese settings give non-system Pods 15 seconds to gracefully terminate before\nthey are forcibly stopped. Critical system Pods have 15 seconds to shut down\nafter the non-system Pods have terminated. However, since the feature operates\non a best-effort basis, there's a possibility that a node might not be able to\nshut down gracefully within the designated 30-second period.\n\nTriggers and limitations\n------------------------\n\nEvents that trigger graceful node shutdown include planned events such as the\nfollowing:\n\n- User-commanded shutdowns\n- Termination of instances\n- Scheduled maintenance\n- Scaling down a cluster\n\nIn these scenarios, the `kubelet` detects the node shutdown event and initiates\nthe graceful node shutdown process.\n\nIn contrast, graceful node shutdown can't be activated when the shutdown command\ndoesn't trigger the `systemd` inhibitor lock mechanism that the `kubelet`\ncomponent relies on. Examples of those kinds of situations include the\nfollowing:\n\n- Network disconnections\n- Hardware malfunctions\n- Insufficient resources such as memory or CPU\n- Unexpected power outages.\n\nIn these cases, the node might shut down abruptly, potentially causing\ndisruptions or data loss."]]