简体   繁体   中英

How to export GKE's cluster autoscaler logs to an external logging service?

I'd like to export the cluster autoscaler logs to something like elasticsearch. However due to the fact that the cluster autoscaler is running "internally" on GKE - means I don't have access to the node that would be running it ( https://github.com/kubernetes/autoscaler/issues/972 ).

I can get the "events" from the Kubernetes API / kubectl get events ... However this out isn't really in a friendly "log format".

How can I export these events to elasticsearch, or how can I get access to the GKE cluster autoscaler's logs?

For the reason that you pointed out (google-managed master), there is currently no way to get access to Cluster Autoscaler logs in Google Kubernetes Engine (GKE). However, if you have Stackdriver Logging enabled, then the Event Explorer can retrieve Cluster Autoscaler event logs. Please see the Stackdriver Filter below.

Note that, as of present, those event logs will only show actions that were taken and not why an action was not taken.

As for exporting these logs to Elasticsearch, the following two links 1 & 2 may be useful to you for exporting logs from Logging to an Elasticsearch cluster.

Stackdriver Filter:

resource.type="gke_cluster"
jsonPayload.source.component="cluster-autoscaler"
logName="projects/[project]/logs/events"
resource.labels.cluster_name="[cluster name]"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM