---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluentd
  # namespace: kube-system
  labels:
    k8s-app: fluentd-logging
    version: v1
spec:
  selector:
    matchLabels:
      k8s-app: fluentd-logging
      version: v1
  template:
    metadata:
      labels:
        k8s-app: fluentd-logging
        version: v1
    spec:
      serviceAccount: fluentd
      serviceAccountName: fluentd
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      containers:
      - name: fluentd
        image: yukin01/fluentd-kubernetes-daemonset:v1.6.3-debian-stackdriver-0.1
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: "/etc/google/auth/google-application-credentials.json"
        - name: FLUENTD_OPT
          value: -vv
        resources:
          limits:
            memory: 500Mi
          requests:
            cpu: 100m
            memory: 200Mi
        volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
        - name: googleapplicationcredentials
          mountPath: /etc/google/auth
          readOnly: true
      terminationGracePeriodSeconds: 30
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
      - name: googleapplicationcredentials
        secret:
          secretName: fluentd-secret
          items:
          - key: google-application-credentials.json
            path: google-application-credentials.json
