Kubernetes Log Structure

Introduction

容器标准输出/标准错误日志路径:Docker Engine 会将所有容器的标准输出和标准错误日志落盘到Node节点的 /var/lib/docker/containers 路径,该路径中包含容器的元数据和日志文件。

By default, if a container restarts, the kubelet keeps one terminated container with its logs. If a pod is evicted from the node, all corresponding containers are also evicted, along with their logs.

https://kubernetes.io/docs/concepts/cluster-administration/logging/


Structure


Solution

k8s集群日志通用收集方案

  • 集群内相关组件日志使用fluentd/filebeat收集
  • 应用输出到标准输出或标准错误输出的日志使用fluentd/filebeat收集
  • 应用输出到容器中指定文件日志使用fluent-bit/filebeat收集

Reference