Develop/k8s
Fluent-Bit Systemd Logging
팡연
2025. 2. 18. 22:49
반응형
Fluent-Bit 을 k8s DaemonSet 으로 실행할 경우 서버 내의 journal 폴더가 /var/log/journal 로 되어있을 경우
마운트 설정이 필요없지만, 아닐 경우 DaemonSet 에 마운트해야한다.
journal이 위치한 경로를 찾아 설정한다.
DaemonSet 수정
kubectl edit ds -n fluent-bit -n fluent
...
spec:
containers:
- args:
-
...
command:
...
volumeMounts:
- mountPath: /run/log/journal ## 추가
name: systemd-log ## 추가
readOnly: true ## 추가
dnsPolicy:
restartPolicy:
...
toleration:
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
volumes:
- hostPath: ## 추가
path: /run/log/journal ## 추가
name: systemd-log ## 추가
수정 후 ConfigMap 수정
kubectl edit cm fluent-bit -n fluent
[INPUT]
Name systemd
Path /run/log/journal
Tag systemd.*
Systemd_Filter _SYSTEM_UNIT=kubelet.service
Systemd_Filter _SYSTEM_UNIT=containerd.service
Read_From_tail On
## 아래는 없어도 됨
[FILTER]
Name record_modifier
Match systemd.*
Record kubernetes systemd
반응형