apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app.kubernetes.io/managed-by: karavel
    app.kubernetes.io/name: promtail
    app.kubernetes.io/part-of: loki
    app.kubernetes.io/version: 2.4.1
    karavel.io/component-name: loki
    karavel.io/component-version: 0.1.0-SNAPSHOT
  name: promtail
  namespace: monitoring
spec:
  selector:
    matchLabels:
      app.kubernetes.io/managed-by: karavel
      app.kubernetes.io/name: promtail
      app.kubernetes.io/part-of: loki
      karavel.io/component-name: loki
  template:
    metadata:
      labels:
        app.kubernetes.io/managed-by: karavel
        app.kubernetes.io/name: promtail
        app.kubernetes.io/part-of: loki
        app.kubernetes.io/version: 2.4.1
        karavel.io/component-name: loki
        karavel.io/component-version: 0.1.0-SNAPSHOT
    spec:
      containers:
      - args:
        - -config.file=/etc/promtail/promtail.yaml
        - -client.url=http://loki:3100/loki/api/v1/push
        env:
        - name: HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        image: grafana/promtail:2.4.1
        imagePullPolicy: IfNotPresent
        name: promtail
        ports:
        - containerPort: 3101
          name: http-metrics
        readinessProbe:
          failureThreshold: 5
          httpGet:
            path: /ready
            port: http-metrics
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          limits:
            cpu: 200m
            memory: 128Mi
          requests:
            cpu: 100m
            memory: 128Mi
        securityContext:
          readOnlyRootFilesystem: true
          runAsGroup: 0
          runAsUser: 0
        volumeMounts:
        - mountPath: /etc/promtail
          name: config
        - mountPath: /run/promtail
          name: run
        - mountPath: /var/lib/docker/containers
          name: docker
          readOnly: true
        - mountPath: /var/log/pods
          name: pods
          readOnly: true
      initContainers:
      - command:
        - sh
        - -c
        - sysctl -w fs.inotify.max_user_instances=128
        image: busybox
        name: init
        securityContext:
          privileged: true
      serviceAccountName: promtail
      tolerations:
      - operator: Exists
      volumes:
      - configMap:
          name: promtail
        name: config
      - hostPath:
          path: /run/promtail
        name: run
      - hostPath:
          path: /var/lib/docker/containers
        name: docker
      - hostPath:
          path: /var/log/pods
        name: pods
  updateStrategy:
    rollingUpdate:
      maxUnavailable: 1
    type: RollingUpdate
