DataONEorg / k8s-cluster

Documentation on the DataONE Kubernetes cluster
Apache License 2.0
2 stars 1 forks source link

Logging Infrastructure for K8s Clusters #43

Open artntek opened 7 months ago

artntek commented 7 months ago

Goals - Install a k8s log framework that...

artntek commented 7 months ago

I did a bunch of research and prototyping, and discovered that, in a modern k8s environment, the ELK stack (Elasticsearch - Logstash - Kibana) has been superseded by the EFK stack, where Logstash is replaced by Fluentd, FluentBit or FileBeat.

Simple overview:

  1. Our k8s applications log to stdout, and this output is collected on the host Node machine, under /var/log/contianers/*.log (standard k8s functionality).
  2. We need to install logging agents that do 3 things:
    1. aggregate logs from each of the node machines
    2. parse and transform them into the required structured logging format
    3. send copies to elasticsearch and to the central syslog archive.
  3. Use the tools provided by Kibana to view and analyze the logs that are in elasticsearch.

Steps to deploy

  1. install the Elasticsearch Bitnami chart, with the Kibana subchart enabled
  2. install the Fluent Bit Bitnami chart
  3. Note there is some config that needs to be changed in each case
artntek commented 7 months ago

Choice of Logging Agents:

Fluent Bit

...is essentially a faster, smaller-footprint replacement for Fluentd, and is much better suited to k8s.

FileBeat

I tried setting this up, but was unsuccessful in getting the pods to run without restarting - so I switched to Fluent Bit. mostly because there was a bitnami chart available. I did notice, after the fact, that there were some log entires in ES that I think must have come from FileBeat, despite it's instability, so who knows.

rsyslog

This also seems to be an option (especially if it is already running on our Node hosts), but I have not tried it yet.

syslog-ng

Supposed to be a super-duper version of rssylog. Didn't try it

artntek commented 7 months ago

see PR #45

artntek commented 7 months ago

Suggested next steps

Fluent Bit

FileBeat: