Review GKE node pool auto-repair settings

Combine node auto-repair with failure monitoring to reduce prolonged outages.

Description

GKE can repair nodes that repeatedly fail its health checks. Set management.auto_repair = true on the Standard node pool. The Google provider enables it by default.

Potential impact

When repair is off, workloads can stay unavailable until an operator intervenes. Replacing a node during repair can also interrupt workloads.

Remediation

After applying, check the pool’s auto-repair setting and node health in GKE. Prepare workloads for node replacement and maintain alerts, a manual recovery procedure and data backups. Manage security patches through node upgrades.

Examples

The examples remove the default pool and configure the separately managed my-node-pool. Supply the project, networking and node service account for your environment.

Before

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
  }
}

After

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
  }
}

References