gpt4 book ai didi

kubernetes - 如何查看终止的 Pod 的日志

转载 作者:行者123 更新时间:2023-12-02 11:27:32 31 4
gpt4 key购买 nike

我正在运行 selenium hubs 并且我的 pod 经常被终止。我想查看终止的 pod 的日志。怎么做?

NAME                                               READY     STATUS              RESTARTS   AGE
chrome-75-0-0e5d3b3d-3580-49d1-bc25-3296fdb52666 0/2 Terminating 0 49s
chrome-75-0-29bea6df-1b1a-458c-ad10-701fe44bb478 0/2 Terminating 0 23s
chrome-75-0-8929d8c8-1f7b-4eba-96f2-918f7a0d77f5 0/2 ContainerCreating 0 7s

kubectl logs chrome-75-0-8929d8c8-1f7b-4eba-96f2-918f7a0d77f5
Error from server (NotFound): pods "chrome-75-0-8929d8c8-1f7b-4eba-96f2-918f7a0d77f5" not found
$ kubectl logs chrome-75-0-8929d8c8-1f7b-4eba-96f2-918f7a0d77f5 --previous
Error from server (NotFound): pods "chrome-75-0-8929d8c8-1f7b-4eba-96f2-918f7a0d77f5" not found

最佳答案

运行 kubectl logs -p将从 API 级别的现有资源中获取日志。这意味着使用此命令终止 pod 的日志将不可用。

正如其他答案中提到的,最好的方法是通过 logging agents or directly pushing these logs into an external service 集中您的日志。 .

或者,并给出 logging architecture in Kubernetes ,您也许可以 fetch the logs directly from the log-rotate files在托管 Pod 的节点中。但是,此选项可能取决于 Kubernetes 实现,因为在触发 pod 驱逐时可能会删除日志文件。

关于kubernetes - 如何查看终止的 Pod 的日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57007134/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com