dongpao5261 2018-12-19 13:42
浏览 664


I'm looking for the solution of how to get logs from a pod in Kubernetes cluster using golang. I've looked at "" and "", but couldn't understand how to use them for this purpose. I have no issues getting information of a pod or any other object in K8S except for logs.

For example, I'm using Get() from "" to get K8S job info:

found := &batchv1.Job{}
err = r.client.Get(context.TODO(), types.NamespacedName{Name: job.Name, Namespace: job.Namespace}, found)

Please share of how you get pod's logs nowadays. Any suggestions would be appreciated!

Update: The solution provided in Kubernetes go client api for log of a particular pod is out of date. It have some tips, but it is not up to date with current libraries.

  • 写回答

3条回答 默认 最新


      相关推荐 更多相似问题


      • ¥15 关于#python##pyqt#的问题,如何解决?
      • ¥15 html+css网页设计 html+css网页设计
      • ¥15 用html加css制作一个网页
      • ¥200 MFC中如何对ListCtrl的某一列的文本能换行显示
      • ¥15 clion添加库文件
      • ¥15 ERROR C2143怎么出现的?为什么ERROR C2144会这么转移,它是怎么出现的?该怎么解决?
      • ¥15 华大的hc32l136外部中断引脚怎么设置
      • ¥15 这个问题如何解答,需要答案
      • ¥15 ubuntu18.04 tty报错&tty界面su/sudo命令无法执行,如何解决?
      • ¥20 下面的压缩方法是否可行