apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluentd-es
spec:
  selector:
    matchLabels:
      name: fluentd-es
  template:
    metadata:
      annotations:
        prometheus.io/path: /metrics
        prometheus.io/port: "24231"
        prometheus.io/scrape: "true"
        scheduler.alpha.kubernetes.io/critical-pod: ""
      labels:
        name: fluentd-es
    spec:
      securityContext:
        runAsUser: 0
        runAsGroup: 0
        fsGroup: 0
      containers:
      - env:
        - name: ES_HOST
          value: $(ELASTICSEARCH_LOGGING)
        - name: FLUENTD_OPT
          value: -o /opt/bitnami/fluentd/logs/fluentd.log --log-rotate-age 5 --log-rotate-size
            104857600 --no-supervisor
        image: bitnami/fluentd:1.3.3
        name: fluentd-es
        resources:
          limits:
            memory: 200Mi
          requests:
            memory: 200Mi
        securityContext:
          privileged: true
          capabilities:
            drop: ['ALL']
        volumeMounts:
        - mountPath: /opt/bitnami/fluentd/conf
          name: config
          readOnly: true
        - mountPath: /opt/bitnami/fluentd/conf/config.d
          name: configd
          readOnly: true
        - mountPath: /var/lib/docker/containers
          name: varlibdockercontainers
          readOnly: true
        - mountPath: /var/log
          name: varlog
          readOnly: true
        - mountPath: /var/log/fluentd-buffers
          name: varlogbuffers
        - mountPath: /var/log/fluentd-pos
          name: varlogpos
      serviceAccountName: fluentd-es
      volumes:
      - configMap:
          defaultMode: 420
          name: fluentd-es
        name: config
      - configMap:
          defaultMode: 420
          name: fluentd-es-configd
        name: configd
      - hostPath:
          path: /var/lib/docker/containers
          type: Directory
        name: varlibdockercontainers
      - hostPath:
          path: /var/log
          type: Directory
        name: varlog
      - hostPath:
          path: /var/log/fluentd-buffers
          type: DirectoryOrCreate
        name: varlogbuffers
      - hostPath:
          path: /var/log/fluentd-pos
          type: DirectoryOrCreate
        name: varlogpos
