LOW
Source
Trivy
ID
AVD-GCP-0054

Ensure Container-Optimized OS (cos) is used for Kubernetes Engine Clusters Node image

GKE supports several OS image types but COS is the recommended OS image to use on cluster nodes for enhanced security

Impact

Follow the appropriate remediation steps below to resolve the issue.

Use the COS image type

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
resource "google_container_cluster" "primary" {
  name     = "my-gke-cluster"
  location = "us-central1"
}

resource "google_container_node_pool" "good_example" {
  name       = "my-node-pool"
  cluster    = google_container_cluster.primary.id
  node_count = 1

  node_config {
    preemptible  = true
    machine_type = "e2-medium"
    image_type   = "COS"
  }
}