---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluent-bit
  namespace: fluent-bit
  labels:
    app: fluent-bit
spec:
  selector:
    matchLabels:
      app: fluent-bit
  template:
    metadata:
      labels:
        app: fluent-bit
    spec:
      serviceAccountName: fluent-bit
      serviceAccount: fluent-bit
      containers:
        - image: fluent/fluent-bit:1.8.12
          imagePullPolicy: IfNotPresent
          name: fluent-bit
          ports:
            - containerPort: 2020
              name: http-metrics
              protocol: TCP
          env:
            - name: LOG_LEVEL
              value: "info"
          volumeMounts:
            - mountPath: /var/log
              name: varlog
            - mountPath: /var/lib/docker/containers
              name: varlibdockercontainers
              readOnly: true
            - mountPath: /fluent-bit/etc/fluent-bit.conf
              name: config
              subPath: fluent-bit.conf
            - mountPath: /fluent-bit/etc/parsers_custom.conf
              name: config
              subPath: parsers.conf
            - mountPath: /tail-db
              name: tail-db
          resources:
            limits:
              cpu: 100m
              memory: 256Mi
            requests:
              cpu: 10m
              memory: 64Mi
      dnsPolicy: ClusterFirst
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
        - effect: NoExecute
          operator: Exists
      volumes:
        - hostPath:
            path: /var/log
          name: varlog
        - hostPath:
            path: /var/lib/docker/containers
          name: varlibdockercontainers
        - hostPath:
            path: /var/lib/fluent-bit
            type: DirectoryOrCreate
          name: tail-db
        - configMap:
            defaultMode: 420
            name: fluent-bit
          name: config
