---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: splunk-kubernetes-metrics
  labels:
    app: splunk-kubernetes-metrics
    engine: fluentd
    version: 1.4.5
spec:
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      name: splunk-kubernetes-metrics
  template:
    metadata:
      name: splunk-kubernetes-metrics
      labels:
        name: splunk-kubernetes-metrics
        app: splunk-kubernetes-metrics
        engine: fluentd
        version: 1.4.5
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
    spec:
      serviceAccountName: splunk-kubernetes-metrics
      nodeSelector:
        beta.kubernetes.io/os: linux
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
      containers:
      - name: splunk-fluentd-k8s-metrics
        image: docker.io/splunk/k8s-metrics:1.1.4
        imagePullPolicy: IfNotPresent
        env:
        - name: KUBERNETES_NODE_IP
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: SPLUNK_HEC_TOKEN
          valueFrom:
            secretKeyRef:
              name: splunk-kubernetes-metrics
              key: splunk_hec_token
        - name: SSL_CERT_FILE
          value: "/fluentd/etc/splunk/hec_ca_file"
        resources:
          limits:
            cpu: 200m
            memory: 300Mi
          requests:
            cpu: 200m
            memory: 300Mi
        volumeMounts:
        - name: conf-configmap
          mountPath: "/fluentd/etc"
        - name: secrets
          mountPath: "/fluentd/etc/splunk"
          readOnly: true
      volumes:
      - name: conf-configmap
        configMap:
          name: splunk-kubernetes-metrics
      - name: secrets
        secret:
          secretName: splunk-kubernetes-metrics
