gpt4 book ai didi

docker - kubernetes 是否支持日志保留?

转载 作者:行者123 更新时间:2023-12-05 00:47:49 24 4
gpt4 key购买 nike

如何定义 kubernetes pod 的日志保留时间?
目前看来日志文件大小没有限制,它使用主机完整的资源。

最佳答案

根据 Logging Architecture从 kubernetes.io 有一些选项

第一个选项

Kubernetes currently is not responsible for rotating logs, but rather a deployment tool should set up a solution to address that. For example, in Kubernetes clusters, deployed by the kube-up.sh script, there is a logrotate tool configured to run each hour. You can also set up a container runtime to rotate application’s logs automatically, e.g. by using Docker’s log-opt. In the kube-up.sh script, the latter approach is used for COS image on GCP, and the former approach is used in any other environment. In both cases, by default rotation is configured to take place when log file exceeds 10MB.





第二种选择

Sidecar containers can also be used to rotate log files that cannot be rotated by the application itself. An example of this approach is a small container running logrotate periodically. However, it’s recommended to use stdout and stderr directly and leave rotation and retention policies to the kubelet.



enter image description here

关于docker - kubernetes 是否支持日志保留?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50899814/

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