为GKE设置错误报告 [英] Setting up ERROR REPORTING for GKE

查看:101
本文介绍了为GKE设置错误报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为部署到GKE的应用设置Stackdriver Error Reporting.

I am trying to setup Stackdriver Error Reporting for an app deployed to GKE.

据我了解,有两种方法可以做到: Stackdriver Logging代理错误报告REST API .

As I understood there are two ways of doing that: Stackdriver Logging agent and Error Reporting REST API.

根据在Google Compute Engine上设置文档如果我已经有正在运行的日志记录代理,则可以在localhost:24224上找到它.

According to Setting up on Google Compute Engine docs If I already have a running logging agent I can reach it on localhost:24224.

似乎已经有GKE的日志记录代理程序了:

It looks like there already is a logging agent for GKE:

✗ kubectl get pods --namespace=kube-system
NAME                                                      READY     STATUS    RESTARTS   AGE
fluentd-cloud-logging-gke-tc-default-pool-5713124a-969q   1/1       Running   0          3d

是否可以通过 fluent-logger-node达到此fluentd ?

推荐答案

很抱歉,非常感谢您您的答案

Steren, thanks a lot for your answer!

让我分享有关此问题的一些细节

Let me share some details around this problem

最近,默认情况下,Stackdriver从GKE中的流行语言中流畅地提取了异常.它将在下一版GKE中启用,并且转储到容器的stdout/stderr的异常将在错误报告中显示.

Recently Stackdriver made fluentd ingest exception from the popular languages in GKE by default. It will be enabled in the next release of GKE and exceptions dumped to stdout/stderr of the container will be visible in Error Reporting.

是否可以通过fluent-logger-node库来达到这种水平?

Is there a way to reach this fluentd with fluent-logger-node library?

GCE和GKE上的日志记录代理工作方式不同.在GCE上,您可以直接在VM上安装代理,并可以使用localhost从同一VM访问它.但是,GKE与Pod一起运行,没有直接安装在节点上.每个Pod都有其自己的网络堆栈,因此,当您从容器内部调用localhost时,您不是在寻址虚拟机,而是在此特定Pod.

Logging agent on GCE and on GKE works differently. On GCE you install agent directly on the VM and can access it from the same VM using localhost. However, GKE operates with pods, nothing's installed directly on the node. Each pod has its own network stack, therefore when you call localhost from inside the container, you are not addressing VM, but rather this specific pod.

如果启用了Stackdriver Logging,则确实会在每个节点上部署fluentd.但是,它在容器中运行,因此,您目前无法轻松地从应用程序中访问它.

It's true that fluentd is deployed on each node if you enable Stackdriver Logging. However, it runs inside a container and because of that you currently cannot easily access it from your application.

将来,Stackdriver和GKE团队将开箱即用地提供可访问的节点级流利端口,但不幸的是,现在您必须自己动手.

In the future, Stackdriver and GKE teams will work on providing accessible node-wide fluentd port out of the box, but now, unfortunately, you have to do it yourself.

如前所述,将另一个流利的代理程序部署为应用程序窗格中的sidecar容器并手动进行配置可能更容易,

As mentioned, it may be easier to deploy another fluentd agent as a sidecar container in the application pod and configure it manually, here is an example how to do it with least efforts. In this case you will be able to access agent using localhost as if it would be on GCE.

这篇关于为GKE设置错误报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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