apiVersion: apps/v1
kind: Deployment
metadata:
  name: telegraf
  labels:
    app: telegraf
spec:
  selector:
    matchLabels:
      app: telegraf
  template:
    metadata:
      labels:
        app: telegraf
    spec:
      containers:
        - name: telegraf
          image: telegraf:v1
          imagePullPolicy: Never
          volumeMounts:
            - name: telegraf-config
              subPath: telegraf.conf
              mountPath: /etc/telegraf/telegraf.conf
              readOnly: true
            - name: docker-unix-socket
              mountPath: /var/run/docker.sock
          envFrom:
            - secretRef:
                name: telegraf
      volumes:
        - name: telegraf-config
          configMap:
            name: telegraf
        - name: docker-unix-socket
          hostPath:
            path: /var/run/docker.sock
            type: Socket
