Reputation: 131
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
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:
Features
-> Logging
.Edit
button.Hope it helps!
Upvotes: 1
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
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