Can't see the pod logs on google GKE
Asked Answered
C

3

6

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?

Convocation answered 18/5, 2022 at 13:28 Comment(4)
Welcome to SOF! Please give more information, like the error you receive, what you typed,... See how to ask a good question here: stackoverflow.com/help/how-to-askDelatorre
No errors, just when I check the deployment in the overview to see the CPU, MEM, DISK all it says is: no data is available for the selected time frame.Convocation
Have you tried kubectl logs deploy/<deployment> and kubectl describe deploy/<deployment> to see what it returns?Delatorre
Did you enable application logs in the GKE cluster logging section?Ringo
C
6

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.

Convocation answered 27/5, 2022 at 20:32 Comment(0)
R
4

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

Ringo answered 19/5, 2022 at 2:11 Comment(0)
O
1

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!

Ovular answered 8/7, 2024 at 3:37 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.