Review GKE node image selection

Choose a supported image for the workload and manage node operating-system updates.

Description

For Linux nodes on GKE Standard, COS_CONTAINERD suits most workloads. Choose a supported Ubuntu image if the workload needs its packages or filesystem features. Windows containers need a Windows image such as WINDOWS_LTSC_CONTAINERD.

Potential impact

An unsupported image may miss security fixes. A Windows container image cannot run unchanged on Linux nodes.

Remediation

To change operating systems, add a separately named node pool in a separate Terraform resource. Test workloads built for the new OS on that pool before migrating them, and keep node upgrades current.

Examples

The excerpts use primary-pool for two alternative operating systems. Set var.project_id, the cluster location and a supported machine type. A Windows pool needs a VPC-native cluster with a Linux pool for system components.

Before

hcl
resource "google_container_node_pool" "example" {
  project = var.project_id
  name    = "primary-pool"
  location = "us-west1"
  cluster = google_container_cluster.example.name

  node_config {
    image_type = "WINDOWS_LTSC_CONTAINERD"
  }
}

After

hcl
resource "google_container_node_pool" "example" {
  project = var.project_id
  name    = "primary-pool"
  location = "us-west1"
  cluster = google_container_cluster.example.name

  node_config {
    image_type = "COS_CONTAINERD"
  }
}

References