How get GCP Error Reporting from Java App running on GKE ( google kubernetes engine )

8/27/2018

in case of Java App Engine, if exception occur from Java App, i can get GCP Error reporting automatically like this

But in case of Java App on GKE, i can't get GCP Error Reporting

How does it can?

-- jaeuk Shin
google-cloud-error-reporting
google-cloud-platform
google-kubernetes-engine
java

2 Answers

9/7/2018

you should install Stackdriver Kubernetes Monitoring to GKE; while one can also use it together with Prometheus. theses features are currently still in beta stage (not being covered by any SLA). also see the Fluentd data collector, which is rather relevant to the Logging API. this visual diagram might explain the most reliable who reports to whom:

K8 Architecture

this one SLF4J example shows how log from within a Java environment, there there's relevant documentation for Logging Application Events with Java (what you might be actually looking for). in principle, the logger within the Java environment needs to tell the local agent, what is going on.

concerning the Logging API in Kubernetes, see Logging Using Stackdriver and Customizing Stackdriver Logs for Kubernetes Engine with Fluentd; there is more than one way to do that.

the Monitoring API and the Logging API can be used independently, while they nevertheless observe the same resources and the same timeline, that's why utilizing both makes sense.

concerning the access scope required:

You must be an Owner of the project containing your cluster.

-- Martin Zeitler
Source: StackOverflow

8/27/2018

As mentioned in the doc Stackdriver Error Reporting is automatically enabled for App Engine environment applications. However on GKE, you must add the cloud-platform access scope when creating the cluster. The preferred way to collect the error is to able to post to Stackdriver Error Reporting using the REST API or Error Reporting Client Libraries

-- KarthickN
Source: StackOverflow