Setting up ERROR REPORTING for GKE

I am trying to configure Stackdriver Error Reporting for an application deployed in GKE.

As I understand it, there are two ways to do this: Stackdriver Registration Agent and REST API Error Report .

According to Setting up the Google Compute Engine docs If I already have a working registration agent, I can contact him at localhost:24224 .

It appears that a registration agent already exists 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 

Is there a way to achieve this fluentd using the fluent-logger-node library ?

0
source share
2 answers

Stern, thanks for your reply !

Let me share some details around this issue.

Stackdriver recently made fluentd ingest an exception to popular languages ​​in GKE by default. It will be included in the next release of GKE, and exceptions thrown in the stdout / stderr container will be visible in the error report.

Is there a way to get to this level using the fluent-logger-node library?

The registration agent in GCE and GKE works differently. In GCE, you install the agent directly on the virtual machine and can access it from the same virtual machine using localhost . However, GKE works with containers; nothing is installed directly on the node. Each block has its own network stack, so when you call localhost from inside the container, you are not accessing the VM, but rather this particular container.

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

In the future, the Stackdriver and GKE teams will work to provide an accessible node to the fluentd public port out of the box, but now, unfortunately, you have to do it yourself.

As already mentioned, it might be easier to deploy another fluentd agent as a sidecar container in the pod application and configure it manually, here is an example of how to do this with the least effort . In this case, you can access the agent using localhost , as if it were on GCE.

+1
source

(Note that Stackdriver Error Reporting is not officially supported yet)

This question and answer can help you with the configuration of fluentd: How to set up a bug report in Stackdriver from kubernetes pods?

But also, since you seem to be using Node.js, I would advise you to directly use https://github.com/GoogleCloudPlatform/cloud-errors-nodejs , which does not send errors through the log, but directly to the error reporting API.

0
source

Source: https://habr.com/ru/post/1266820/


All Articles