Review GKE Cloud Logging integration

Collect required system and workload logs and verify delivery.

Description

For a GKE Standard cluster, use logging_service = "logging.googleapis.com/kubernetes" to send system and workload logs to Cloud Logging. To select individual components, use logging_config.

Potential impact

With none, the cluster can lose the Pod error records you need to diagnose failures. Google Cloud records Admin Activity audit logs separately.

Remediation

Choose the control-plane logs and workload output you need. If workload logging is enabled, write a test message to container stdout and find it in Logs Explorer for that cluster and container. If it is missing, check write permissions and exclusion filters. Set retention and reader access.

Examples

The excerpts change only the logging service on the same cluster. Supply the network and remaining node settings for your environment.

Before

hcl
resource "google_container_cluster" "cluster" {
  name               = "marcellus-wallace"
  location           = "us-central1-a"
  initial_node_count = 3
  logging_service    = "none"
}

After

hcl
resource "google_container_cluster" "cluster" {
  name               = "marcellus-wallace"
  location           = "us-central1-a"
  initial_node_count = 3
  logging_service    = "logging.googleapis.com/kubernetes"
}

References