[英]How to check failed container logs in Kubernetes
Before i check the logs, pods are failing and removed by jenkins and I am unable to see the logs.在我检查日志之前,Pod 失败并被 jenkins 删除,我无法看到日志。 How can i check the logs of the pods that are removed.我如何检查已删除的 pod 的日志。
is there any simple way to save the logs in kubernetes.有什么简单的方法可以将日志保存在 kubernetes 中。
I don't have any logging system for my kubernetes.我的 kubernetes 没有任何日志记录系统。
In a fraction of seconds, it keeps creating and deleting because of some error.在几秒钟内,由于某些错误,它会不断创建和删除。 I want to find what the error is.我想找出错误是什么。 before i check the logs, the container name is changed.在我检查日志之前,容器名称已更改。
Thanks,谢谢,
Most probably you meant "pods are failing and removed by kubernetes and I am unable to see the logs."很可能您的意思是“Pod 出现故障并被kubernetes删除,我看不到日志。” This is kubernetes itself who manage API objects, not jenkins.这是管理 API 对象的 kubernetes 本身,而不是 jenkins。
Answering your question directly - you are not able to fetch any logs from any of your containers once related POD was deleted.直接回答您的问题 - 删除相关 POD 后,您将无法从任何容器中获取任何日志。 Deletion pod means wiping all pod's containers with all the data included.删除 pod 意味着擦除包含所有数据的所有 pod 容器。 Logs were deleted in the moment your pod was terminated.在您的 pod 终止的那一刻,日志已被删除。
By default, if a container restarts, the kubelet keeps one terminated container with its logs.默认情况下,如果容器重新启动,kubelet 会保留一个终止的容器及其日志。 If a pod is evicted from the node, all corresponding containers are also evicted, along with their logs .如果一个 pod 被逐出节点,所有相应的容器也会连同它们的日志一起被逐出。
If you pod were alive - you would be able to use ----previous flag to check the logs, but unfortunatelly thats not your case.如果您的 pod 还活着 - 您将能够使用----previous标志来检查日志,但不幸的是,这不是您的情况。
There are a lot of similar questions - and the only main suggestion is to set up some log aggregation system that will store logs separately.有很多类似的问题 - 唯一的主要建议是设置一些日志聚合系统,将单独存储日志。 IN that case you wont lose them and will be able at least check them.在这种情况下,您不会丢失它们,并且至少能够检查它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.