apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluent-bit
  labels:
    k8s-app: fluent-bit
    version: v1
    kubernetes.io/cluster-service: "true"
spec:
  selector:
    matchLabels:
      k8s-app: fluent-bit
  template:
    metadata:
      labels:
        k8s-app: fluent-bit
        version: v1
        kubernetes.io/cluster-service: "true"
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "http"
        prometheus.io/path: "/api/v1/metrics/prometheus"
        reloader.stakater.com/auto: "true"
    spec:
      containers:
        - name: fluent-bit
          image: fluent/fluent-bit:1.8.15
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 2020
              protocol: TCP
          volumeMounts:
            - name: varlog
              mountPath: /var/log
            - name: fluent-bit-config
              mountPath: /fluent-bit/etc/
            - name: etcmachineid
              mountPath: /etc/machine-id
              readOnly: true
          resources:
            limits:
              memory: 2000Mi
            requests:
              cpu: 500m
              memory: 100Mi
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /api/v1/health
              port: http
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirstWithHostNet
      volumes:
        - name: varlog
          hostPath:
            path: /var/log
        - name: fluent-bit-config
          configMap:
            name: fluent-bit-config
        - name: etcmachineid
          hostPath:
            path: /etc/machine-id
            type: File
      serviceAccountName: fluent-bit
      tolerations:
        - key: node-role.kubernetes.io/master
          operator: Exists
          effect: NoSchedule
        - operator: "Exists"
          effect: "NoExecute"
        - operator: "Exists"
          effect: "NoSchedule"
