<p>I am new to Kubernetes world,I am trying to deploy &quot;Filebeat&quot; demonset on Azure Kubernetes services(AKS) but facing the below error, please help me out:</p>
<p><strong>Error:</strong>
<a href="https://i.stack.imgur.com/7W1qJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7W1qJ.png" alt="enter image description here" /></a></p>
<p>My code was grabbed from <a href="https://github.com/elastic/beats/tree/master/deploy/kubernetes/filebeat" rel="nofollow noreferrer">https://github.com/elastic/beats/tree/master/deploy/kubernetes/filebeat</a></p>
<p>Below is the code which am trying to execute.</p>
<p><strong>filebeat-configmap.yaml</strong></p>
<pre><code>---

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: filebeat-config
      namespace: kube-system
      labels:
        k8s-app: filebeat
    data:
      filebeat.yml: |-
        filebeat.inputs:
        - type: container
          paths:
            - /var/log/containers/*.log
          processors:
            - add_kubernetes_metadata:
                host: ${NODE_NAME}
                matchers:
                - logs_path:
                    logs_path: &quot;/var/log/containers/&quot;
    
        # To enable hints based autodiscover, remove `filebeat.inputs` configuration and uncomment this:
        #filebeat.autodiscover:
        #  providers:
        #    - type: kubernetes
        #      node: ${NODE_NAME}
        #      hints.enabled: true
        #      hints.default_config:
        #        type: container
        #        paths:
        #          - /var/log/containers/*${data.kubernetes.container.id}.log
    
        processors:
          - add_cloud_metadata:
          - add_host_metadata:
    
        #cloud.id: ${ELASTIC_CLOUD_ID}
        #cloud.auth: ${ELASTIC_CLOUD_AUTH}
    
        output.elasticsearch:
          hosts: ['${ELASTICSEARCH_HOST:10.x.x.x}:${ELASTICSEARCH_PORT:9200}']
          #username: ${ELASTICSEARCH_USERNAME}
          #password: ${ELASTICSEARCH_PASSWORD}
</code></pre>
<p><strong>filebeat-daemonset.yaml</strong></p>
<pre><code>apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: filebeat
  namespace: kube-system
  labels:
    k8s-app: filebeat
spec:
  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:%VERSION%
        args: [
          &quot;-c&quot;, &quot;/etc/filebeat.yml&quot;,
          &quot;-e&quot;,
        ]
        env:
        - name: ELASTICSEARCH_HOST
          value: &quot;10.x.x.x&quot;
        - name: ELASTICSEARCH_PORT
          value: &quot;9200&quot;
        #- 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: 0640
          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:
          # When filebeat runs as non-root user, this directory needs to be writable by group (g+w).
          path: /var/lib/filebeat-data
          type: DirectoryOrCreate
</code></pre>
<p><strong>filebeat-role.yaml</strong></p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: filebeat
  labels:
    k8s-app: filebeat
rules:
- apiGroups: [&quot;&quot;] # &quot;&quot; indicates the core API group
  resources:
  - namespaces
  - pods
  - nodes
  verbs:
  - get
  - watch
  - list
- apiGroups: [&quot;apps&quot;]
  resources:
    - replicasets
  verbs: [&quot;get&quot;, &quot;list&quot;, &quot;watch&quot;]
</code></pre>
<p><strong>filebeat-role-binding.yaml</strong></p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: filebeat
subjects:
- kind: ServiceAccount
  name: filebeat
  namespace: kube-system
roleRef:
  kind: ClusterRole
  name: filebeat
  apiGroup: rbac.authorization.k8s.io
</code></pre>
<p><strong>filebeat-service-account.yaml</strong></p>
<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
  name: filebeat
  namespace: kube-system
  labels:
    k8s-app: filebeat
</code></pre>

Docgyan
<pre><code>       #- name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
</code></pre>
<p>You commented out the <code>name:</code> line when you didn't mean to.</p>
