首页 > 解决方案 > 如何在 azure devops 中通过邮件发送 kubectl 日志输出

问题描述

我有一个 azuredevops 构建作业来获取部署 pod 的日志。

命令: kubectl logs deployment/myapp

我在 azure devops 管道的摘要页面中获得输出,但同样我想发送一个带有日志作为附件的团队。为此,我在 azure devops 中没有任何选择

标签: kubernetesazure-devops

解决方案


Basically, your k8s log (pods) will gone after the pods has been terminated (although you can somehow keep it for a little while). For debug purpose or any other purpose you want, you need to Centralized logging your k8s log (use some tools: filebeat, fluentd, fluent-bit to forward your k8s log to elasticsearch).

EX: Some software (tools) for Centralized logging Elasticsearch, Graylog, ...

https://www.elastic.co/fr/what-is/elk-stack

And then you can save, export, analyze your log ... You can do anythings you want with your stored k8s log.

Hope this may help you, guy!

Edit: I use GCP as cloud solution and in GCP, by default, they will use fluentd to forward your k8s log to store in Logging. And the Logging has feature Export, I think you can search somethings similar to Logging in your cloud solution: Azure


推荐阅读