47 lines
1.6 KiB
YAML
47 lines
1.6 KiB
YAML
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata: { name: fluent-bit, namespace: observability }
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata: { name: fluent-bit-read }
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["pods", "namespaces"]
|
|
verbs: ["get", "list", "watch"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata: { name: fluent-bit-read }
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: fluent-bit-read
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: fluent-bit
|
|
namespace: observability
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: DaemonSet
|
|
metadata: { name: fluent-bit, namespace: observability }
|
|
spec:
|
|
selector: { matchLabels: { app: fluent-bit } }
|
|
template:
|
|
metadata: { labels: { app: fluent-bit } }
|
|
spec:
|
|
serviceAccountName: fluent-bit
|
|
containers:
|
|
- name: fluent-bit
|
|
image: cr.fluentbit.io/fluent/fluent-bit:2.2.2
|
|
volumeMounts:
|
|
- { name: varlog, mountPath: /var/log }
|
|
- { name: containers, mountPath: /var/lib/docker/containers, readOnly: true }
|
|
env:
|
|
- { name: FLUENT_ELASTICSEARCH_HOST, value: elasticsearch.elastic.svc.cluster.local }
|
|
- { name: FLUENT_ELASTICSEARCH_PORT, value: "9200" }
|
|
args: ["-i","tail","-p","path=/var/log/containers/*.log","-F","kubernetes","-o","es","-p","host=${FLUENT_ELASTICSEARCH_HOST}","-p","port=${FLUENT_ELASTICSEARCH_PORT}","-p","logstash_format=On","-p","logstash_prefix=k8s-logs"]
|
|
volumes:
|
|
- { name: varlog, hostPath: { path: /var/log } }
|
|
- { name: containers, hostPath: { path: /var/lib/docker/containers, type: DirectoryOrCreate } }
|