Navir
Navir

Reputation: 131

Can't see the pod logs on google GKE

I have a deployment on google gke, and I can't see the pod logs on the console even though the Cloud logging is enabled on the cluster? So what could be the issue? did I miss something?

Upvotes: 6

Views: 5325

Answers (3)

Hendri
Hendri

Reputation: 87

If you're using Terraform to manage your GKE cluster, you can enable specific logging components by setting the enable_components field in your logging_config. Here's how you can do it:

resource "google_container_cluster" "my_cluster" {
  // your other cluster configs

  logging_config {
    enable_components = ["SYSTEM_COMPONENTS", "WORKLOADS"]
  }
}

You can refer to the Terraform documentation for more details: GKE Cluster Logging Config.

If you're managing your cluster through the GCP Console, follow these steps:

  1. Go to your GKE Cluster configuration.
  2. Navigate to Features -> Logging.
  3. Click the Edit button.
  4. Configure the logging components as needed.

Logging Components Options

Hope it helps!

Upvotes: 1

Navir
Navir

Reputation: 131

Yes, I found the reason,I found out that the cluster was using a specific service account that hasn't logging and monitoring roles assigned. I assigned those roles to that service account and everything is working well.

Upvotes: 6

Sam Stoelinga
Sam Stoelinga

Reputation: 5021

It sounds like Workload monitoring and logging may not have been enabled and currently it's only doing system monitoring and logging. Please see the docs here on how to change the logging settings: https://cloud.google.com/stackdriver/docs/solutions/gke/installing#installing

Upvotes: 4

Related Questions