apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: newrelic-logging
  namespace: newrelic
  labels:
    k8s-app: newrelic-logging
    version: v1
    kubernetes.io/cluster-service: "true"
    name: newrelic-logging
    app.kubernetes.io/name: newrelic-logging
spec:
  selector:
    matchLabels:
      name: newrelic-logging
  template:
    metadata:
      labels:
        k8s-app: newrelic-logging
        version: v1
        kubernetes.io/cluster-service: "true"
        name: newrelic-logging
        app.kubernetes.io/name: newrelic-logging
    spec:
      serviceAccountName: newrelic-logging
      containers:
        - name: newrelic-logging
          env:
            - name: ENDPOINT
              value : "https://log-api.newrelic.com/log/v1"
            - name: SOURCE
              value: "kubernetes"
            - name: LICENSE_KEY
              value: <YOUR_LICENSE_KEY>
            - name: CLUSTER_NAME
              value: <YOUR CLUSTER NAME>
            - name: LOG_LEVEL
              value: "info"
            # Allowed values: "docker", "cri"
            - name: LOG_PARSER
              value: "docker"
            - name: PATH
              value: "/var/log/containers/*.log"
          image: newrelic/newrelic-fluentbit-output:1.4.6
          command:
            - /fluent-bit/bin/fluent-bit
            - -c
            - /fluent-bit/etc/fluent-bit.conf
            - -e
            - /fluent-bit/bin/out_newrelic.so
          resources:
            limits:
              cpu: 500m
              memory: 128Mi
            requests:
              cpu: 250m
              memory: 64Mi
          volumeMounts:
            - name: config
              mountPath: /fluent-bit/etc
            - name: varlog
              mountPath: /var
      terminationGracePeriodSeconds: 10
      volumes:
        - name: config
          configMap:
            name: fluent-bit-config
        - name: varlog
          hostPath:
            path: /var
