在Kubernetes Pod中获取日志的选项 [英] Options for getting logs in kubernetes pods

查看:119
本文介绍了在Kubernetes Pod中获取日志的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在kubernetes容器中几乎没有开发人员日志,什么是获取日志以供开发人员查看的最佳方法.

Have few developer logs in kubernetes pods, what is the best method to get the logs for the developers to see it.

我们可以使用任何特定工具吗?

Any specific tools that we can use?

我可以选择使用Graylog,但是不确定是否可以对其进行自定义以使开发人员登录日志.

I have the option of graylog, but not sure if that can be customized to get the developer logs into it.

推荐答案

最基本的方法是简单地使用kubectl logs命令:

The most basic method would be to simply use kubectl logs command:

打印容器或指定资源中容器的日志.如果 pod只有一个容器,容器名称是可选的.

Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.

在这里,您可以找到有关该命令的更多详细信息它是带有一些有用示例的标志.

Here you can find more details regarding the command and it's flags alongside some useful examples.

此外,您可能需要使用:

Also, you may want to use:

使用Stackdriver记录

这两种方法都可以解决您的问题.

Both should do the trick in your case.

请告诉我您是否在想什么,我的回答是否有帮助.

Please let me know if that is what you had on mind and if my answer was helpful.

这篇关于在Kubernetes Pod中获取日志的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆