Ensure GCP Kubernetes engine clusters have stackdriver logging enabled

Error: GCP Kubernetes Engine Clusters have Cloud Monitoring disabled

Bridgecrew Policy ID: BC_GCP_KUBERNETES_3
Checkov Check ID: CKV_GCP_8
Severity: MEDIUM

GCP Kubernetes Engine Clusters have Cloud Monitoring disabled


Stackdriver is the default logging solution for clusters deployed on GKE. Stackdriver logging is deployed to a new cluster by default, explicitly set to opt-out. Stackdriver logging collects only the container’s standard output and standard error streams. To ingest logs, Stackdriver logging agent must be deployed to each node in the cluster. Stackdriver provides a single-pane-of-glass view of metrics, logs, and traces through Kubernetes Engine clusters and workloads.

We recommend you use Stackdriver logging as a unified data logging solution for GKE workloads unless additional observability tooling is already in place.

Fix - Buildtime


resource "google_container_cluster" "primary" {
  name     = "my-gke-cluster"
  location = "us-central1"
  remove_default_node_pool = true
  initial_node_count       = 1
  monitoring_service = "monitoring.googleapis.com/kubernetes"