kubernetes - Kubernetes - 保存 pod 的执行日志
问题描述
我正在尝试将容器的执行日志保留在 Kubernetes 中。
我在我的 cronjob yamlsuccessfulJobsHistoryLimit: 5 failedJobsHistoryLimit: 5
中添加了以查看执行历史记录,但是当我尝试查看 pod 的日志时出现此错误
我认为这是因为 pod 已被删除,因为当我转到正在运行的 pod 时,我可以看到日志。
那么有没有办法将日志保存在 Kubernetes 的这一部分中,或者我必须设置一些东西才能拥有这个功能?
抱歉,如果有人问过这个问题,但我并没有真正找到任何东西,而且我是 Kubernetes 的新手。
感谢您的回复。
解决方案
Looking at this problem in a bigger picture it's generally a good idea to have your logs stored via logging agents or directly pushed into an external service as per the official documentation.
Taking advantage of Kubernetes logging architecture explained here you can also try to fetch the logs directly from the log-rotate files in the node hosting the pods. Please note that this option might depend on the specific Kubernetes implementation as log files might be deleted when the pod eviction is triggered.
推荐阅读
- forms - Flutter/Firebase - 断言失败:第 61 行 pos 12:'field != null':不正确
- javascript - 将 http 请求中的 base64 图像发送到服务器
- ffmpeg - FFMPEG YUV444 转 YUV420
- python - 通过 ForeignKey 的 Django 用户特定对象
- elasticsearch - 具有基本身份验证的 Elasticsearch helm 图表
- javascript - this.activatedRoute.parent 在角度服务中为空
- node.js - 获取接口'响应
'错误地扩展接口'响应' - webpack - webpack的模块导出resolve.alias上的at符号是什么意思?
- javascript - 如何在 React 中的其他组件的 MAP 中插入组件?
- r - 面对用户输入作为 dplyr 过滤条件创建动态 Rshiny 应用程序的问题