apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.kompose.service: filebeat
  name: filebeat
spec:
  replicas: 2
  selector:
    matchLabels:
      io.kompose.service: filebeat
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        io.kompose.network/elk-tier: "true"
        io.kompose.service: filebeat
    spec:
      containers:
        - command:
            - /bin/sh
            - -c
            - >
                cp /usr/share/filebeat-config/filebeat.ini /usr/share/filebeat/
                filebeat modules enable elasticsearch ;
                filebeat setup ;
                filebeat -e ;
                filebeat
          image: docker.elastic.co/beats/filebeat:7.16.3
          name: filebeat
          resources: {}
          tty: true
          volumeMounts:
            - mountPath: /usr/share/filebeat-config
              name: filebeat-share
            - mountPath: /var/log/backend
              name: filebeat-backend
      restartPolicy: Always
      dnsPolicy: ClusterFirst
      dnsConfig:
        nameservers:
          - 8.8.8.8
      volumes:
        - name: filebeat-share
          secret:
            secretName: filebeat-share
        - name: filebeat-backend
          persistentVolumeClaim:
            claimName: backend-logs-claim
status: {}
