unable to recognize "filebeat-kubernetes.yaml": no matches for kind "DaemonSet" in version "extensions/v1beta1" unable to recognize "filebeat-kubernetes.yaml": no matches for kind "DaemonSet" in version "extensions/v1beta1" kubernetes kubernetes

unable to recognize "filebeat-kubernetes.yaml": no matches for kind "DaemonSet" in version "extensions/v1beta1"


As we can see there

DaemonSet, Deployment, StatefulSet, and ReplicaSet resources will no longer be served from extensions/v1beta1, apps/v1beta1, or apps/v1beta2 by default in v1.16. Migrate to the apps/v1 API

You need to change apiVersion

apiVersion: extensions/v1beta1 -> apiVersion: apps/v1

Then there is another error

missing required field "selector" in io.k8s.api.apps.v1.DaemonSetSpec;

So we have to add selector field

spec:  selector:    matchLabels:      k8s-app: filebeat

Edited DaemonSet yaml:

apiVersion: apps/v1kind: DaemonSetmetadata:  name: filebeat  namespace: kube-system  labels:    k8s-app: filebeatspec:  selector:    matchLabels:      k8s-app: filebeat  template:    metadata:      labels:        k8s-app: filebeat    spec:      serviceAccountName: filebeat      terminationGracePeriodSeconds: 30      hostNetwork: true      dnsPolicy: ClusterFirstWithHostNet      containers:      - name: filebeat        image: docker.elastic.co/beats/filebeat:7.4.0        args: [          "-c", "/etc/filebeat.yml",          "-e",        ]        env:        - name: ELASTICSEARCH_HOST          value: elasticsearch        - name: ELASTICSEARCH_PORT          value: "9200"        - name: ELASTICSEARCH_USERNAME          value: elastic        - name: ELASTICSEARCH_PASSWORD          value: changeme        - name: ELASTIC_CLOUD_ID          value:        - name: ELASTIC_CLOUD_AUTH          value:        - name: NODE_NAME          valueFrom:            fieldRef:              fieldPath: spec.nodeName        securityContext:          runAsUser: 0          # If using Red Hat OpenShift uncomment this:          #privileged: true        resources:          limits:            memory: 200Mi          requests:            cpu: 100m            memory: 100Mi        volumeMounts:        - name: config          mountPath: /etc/filebeat.yml          readOnly: true          subPath: filebeat.yml        - name: data          mountPath: /usr/share/filebeat/data        - name: varlibdockercontainers          mountPath: /var/lib/docker/containers          readOnly: true        - name: varlog          mountPath: /var/log          readOnly: true      volumes:      - name: config        configMap:          defaultMode: 0600          name: filebeat-config      - name: varlibdockercontainers        hostPath:          path: /var/lib/docker/containers      - name: varlog        hostPath:          path: /var/log      # data folder stores a registry of read status for all files, so we don't send everything again on a Filebeat pod restart      - name: data        hostPath:          path: /var/lib/filebeat-data          type: DirectoryOrCreate

Let me know if that help you.