K8s 日志采集 (Daemonset模式)
业务日志落盘到Node → Filebeat → ES → Kibana/Grafana
1、定好规范, 日志写入目录, 如/beta/logs/项目名
2、落盘到本地, Pod 开启hostPath 挂载/beta/logs/项目名
到宿主机
3、Daemonset Filebeat 抓取宿主机/beta/logs/项目名
日志
1、Filebeat 部署
Filebeat v7.10.1、ES v7.10.0
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: filebeat
component: client
name: filebeta
namespace: default
spec:
selector:
matchLabels:
app: filebeat
commponent: client
template:
metadata:
labels:
app: filebeat
commponent: client
spec:
containers:
- env:
- name: HOST_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.hostIP
-