GKE ノードプールの自動修復設定の確認

ノードの自動修復と障害監視を併せて設定し、障害の長期化を抑えてください。

説明

GKE はヘルスチェックに繰り返し失敗したノードを自動修復できます。Standard ノードプールで management.auto_repair = true を指定します。Google プロバイダーの既定値も true です。

想定される影響

修復を無効にすると、運用担当者が対応するまでワークロードの停止が続く場合があります。修復時のノードの置き換えでも一時的に中断する場合があります。

対処方法

適用後、GKE で対象プールの自動修復設定とノードの状態を確認します。ノードの置き換えに備えてワークロードを構成し、障害通知、手動復旧手順、データのバックアップを用意します。セキュリティパッチはノードのアップグレードで管理してください。

例

例では既定のプールを削除し、別に管理する my-node-pool に設定しています。プロジェクト、ネットワーク、ノードのサービスアカウントは環境に合わせて指定します。

変更前

hcl
resource "google_container_cluster" "cluster" {
  name                     = "my-gke-cluster"
  location                 = "us-central1"
  remove_default_node_pool = true
  initial_node_count       = 1
}

resource "google_container_node_pool" "node_pool" {
  name       = "my-node-pool"
  location   = "us-central1"
  cluster    = google_container_cluster.cluster.name
  node_count = 1

  management {
    auto_repair = false
  }
}

変更後

hcl
resource "google_container_cluster" "cluster" {
  name                     = "my-gke-cluster"
  location                 = "us-central1"
  remove_default_node_pool = true
  initial_node_count       = 1
}

resource "google_container_node_pool" "node_pool" {
  name       = "my-node-pool"
  location   = "us-central1"
  cluster    = google_container_cluster.cluster.name
  node_count = 1

  management {
    auto_repair = true
  }
}

参考資料