kubernetes-增加kubectl日志大小

发布于 2025-01-22 12:53:34 字数 486 浏览 0 评论 0原文

我使用Azure Kubernetes Service(AKS)在Kubernetes托管的Docker容器中运行一个应用程序。我可以使用以下方式将日志输出到文本文件以进行应用程序部署:

kubectl logs deployment/my-deployment > out.txt

这使我的文件约为28MB。当我使用docker日志...在物理VM上获取同一容器的Docker日志时,日志文件更大(最高120MB+)。

如何增加部署的可用kubectl日志的大小?如果此选项有可用是相同的。

/etc/daemon.json中的docker配置不是kubectl日志,因为将其设置为50MB。我读过,这是Kubernetes使用的基础码头配置,但事实并非如此,因为我的kubectl日志被截断为大约28mb。

I have an app running in a kubernetes managed docker container, using Azure Kubernetes Service (AKS). I can output logs to a text file for the app deployment using:

kubectl logs deployment/my-deployment > out.txt

This gives me a file of around max 28Mb. When I get the docker logs for the same container on the physical VM using docker logs ..., the log file is much bigger (up to 120Mb+).

How can I increase the size of the available kubectl logs for the deployment? If this option is available, then it would likely be an option that increases the size of the available kubectl logs for the pod that holds the container, as the pod and deployment logs are identical.

It's not the docker configuration in /etc/docker/daemon.json that's limiting the kubectl logs, as that's set to 50Mb. I've read that it's the underlying docker configuration that kubernetes uses, but that doesn't seem to be the case, as mykubectl logs are being truncated to around 28Mb.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2025-01-29 12:53:34

kubectl logs可能会读取日志通过默认日志旋转,意味着 logrotate服务处于活动状态

检查cat /etc/logrotate.d/docker-containers的内容,如 a>,用于确认。

unofficial-kubernetes

节点级记录中的一个重要考虑因素是实现日志旋转,因此日志不会在节点上消耗所有可用的存储。 kubernetes使用logrotate工具来实现日志旋转。

kubernetes每天执行日志旋转,或者日志文件的大小超过10MB。
每个旋转属于一个容器;如果容器反复故障或吊舱被驱逐,则丢失了容器的所有先前旋转。
默认情况下,kubernetes每个容器最多保持五个记录旋转

Kubectl logs might read logs with a default log rotation, meaning the logrotate service is active.

Check the content of cat /etc/logrotate.d/docker-containers, as in this issue, for confirmation.

As explained in unofficial-kubernetes:

An important consideration in node-level logging is implementing log rotation, so that logs don't consume all available storage on the node. Kubernetes uses the logrotate tool to implement log rotation.

Kubernetes performs log rotation daily, or if the log file grows beyond 10MB in size.
Each rotation belongs to a single container; if the container repeatedly fails or the pod is evicted, all previous rotations for the container are lost.
By default, Kubernetes keeps up to five logging rotations per container.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文