apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-gelf
  namespace: kube-system
spec:
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
  selector:
    matchLabels:
      app: kube-gelf
  template:
    metadata:
      labels:
        app: kube-gelf
    spec:
      serviceAccountName: kube-gelf
      dnsPolicy: ClusterFirst
      containers:
      - name: agent
        image: roffe/kube-gelf:latest
        env:
        - name: GELF_HOST
          valueFrom:
            configMapKeyRef:
              name: kube-gelf
              key: GELF_HOST
        - name: GELF_PORT
          valueFrom:
            configMapKeyRef:
              name: kube-gelf
              key: GELF_PORT
        - name: GELF_PROTOCOL
          valueFrom:
            configMapKeyRef:
              name: kube-gelf
              key: GELF_PROTOCOL
        - name: NODENAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        volumeMounts:
        - name: varlog
          mountPath: /var/log
          readOnly: true
        - name: gelf-pos
          mountPath: /pos
          readOnly: false
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
        - name: kube-gelf-config
          mountPath: /fluentd/etc/fluent.conf
          subPath: fluent.conf
      tolerations:
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
      - name: kube-gelf-config
        configMap:
          name: kube-gelf
          items:
          - key: fluent.conf
            path: fluent.conf
      - name: gelf-pos
        hostPath:
          path: /var/log/pos
