简体   繁体   English

如何在 GKE 的 Logs Explorer 中查看容器日志

[英]How to view container logs in GKE's Logs Explorer

In my GKE cluster (version v1.21.10-gke.2000) I would like to see output produced by pods/containers as logs in Logs Explorer.在我的 GKE 集群(版本 v1.21.10-gke.2000)中,我希望在 Logs Explorer 中看到 pod/containers 生成的输出作为日志。

But clicking on Container Logs link in Workloads' Overview tab makes Logs Explorer return 'No data found'.但是单击 Workloads 的 Overview 选项卡中的 Container Logs 链接会使 Logs Explorer 返回“No data found”。 Cloud Logging is enabled (Components: System, Workloads). Cloud Logging 已启用(组件:系统、工作负载)。 Cloud Logging API is enabled as well. Cloud Logging API 也已启用。

What I have tried so far: In another (test) project in a freshly created cluster (version 1.22.8-gke.201) this works correctly, ie what kubectl logs returns is also visible in Logs Explorer.到目前为止我所尝试的:在新创建的集群(版本 1.22.8-gke.201)中的另一个(测试)项目中,这可以正常工作,即kubectl logs返回的内容在日志资源管理器中也可见。 The cluster mentioned at the beginning was created long ago and apparently requires some changes - how can I figure out what cluster (or maybe node pool) settings need to be modified to be able to see container logs in Logs Explorer?开头提到的集群是很久以前创建的,显然需要进行一些更改——我如何才能确定需要修改哪些集群(或者可能是节点池)设置才能在 Logs Explorer 中查看容器日志? I would like to avoid creating a new cluster from scratch.我想避免从头开始创建新集群。

如果您在 Cloud Logging 中看不到任何日志,您可以尝试本文档中有关How to find—and use—your GKE logs with Cloud Logging说明,并找到Make sure you're collecting GKE logs部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM