---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: cadvisor
  namespace: default
  labels:
    k8s-app: cadvisor
spec:
  selector:
    matchLabels:
      name: cadvisor
  template:
    metadata:
      labels:
        name: cadvisor
      annotations:
        cm.example.com/scrape: 'true'
    spec:
      hostNetwork: true
      hostPID: true
      containers:
      - name: cadvisor
        image: google/cadvisor:canary
        volumeMounts:
        - name: rootfs
          mountPath: /rootfs
          readOnly: true
        - name: var-run
          mountPath: /var/run
          readOnly: false
        - name: sys
          mountPath: /sys
          readOnly: true
        - name: docker
          mountPath: /var/lib/docker
          readOnly: true
        ports:
          - name: http
            containerPort: 8080
            protocol: TCP
        args:
          - --profiling
          - --housekeeping_interval=1s
          - --disable_metrics=percpu # enable only diskIO, cpu, memory, network, disk,tcp, udp, process, advtcp
          - --docker_only # only show stats for docker containers
          - --store_container_labels=false
      terminationGracePeriodSeconds: 30
      volumes:
      - name: rootfs
        hostPath:
          path: /
      - name: var-run
        hostPath:
          path: /var/run
      - name: sys
        hostPath:
          path: /sys
      - name: docker
        hostPath:
          path: /var/lib/docker