# Filebeat on Kubernetes, host.name got the pod names (and not the Kubernetes host name ?)

**URL:** <https://discuss.elastic.co/t/filebeat-on-kubernetes-host-name-got-the-pod-names-and-not-the-kubernetes-host-name/189951>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [July 11, 2019, 9:19am UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-host-name-got-the-pod-names-and-not-the-kubernetes-host-name/189951 "2019-07-11T09:19:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![twiggy](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@twiggy](https://discuss.elastic.co/u/twiggy)\
**Post date:** [July 11, 2019, 9:19am UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-host-name-got-the-pod-names-and-not-the-kubernetes-host-name/189951/1 "2019-07-11T09:19:25Z")

</div>

Hello,

Environment : Kibana, metricbeat, filebeat (all 7.2)

I've deployed Filebeat on my Kubernetes cluster using this yaml. It's the one from the official website, but with namespaces (elastic) and elasticsearch host output (elasticsearch-master.elastic) modifications :

```
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-config
  namespace: elastic
  labels:
    k8s-app: filebeat
data:
  filebeat.yml: |-
    filebeat.config:
      inputs:
        # Mounted `filebeat-inputs` configmap:
        path: ${path.config}/inputs.d/*.yml
        # Reload inputs configs as they change:
        reload.enabled: false
      modules:
        path: ${path.config}/modules.d/*.yml
        # Reload module configs as they change:
        reload.enabled: false

    # To enable hints based autodiscover, remove `filebeat.config.inputs` configuration and uncomment this:
    #filebeat.autodiscover:
    # providers:
    # - type: kubernetes
    # hints.enabled: true

    processors:
      - add_cloud_metadata:

    cloud.id: ${ELASTIC_CLOUD_ID}
    cloud.auth: ${ELASTIC_CLOUD_AUTH}

    output.elasticsearch:
      hosts: ['${ELASTICSEARCH_HOST:elasticsearch-master.elastic}:${ELASTICSEARCH_PORT:9200}']
      username: ${ELASTICSEARCH_USERNAME}
      password: ${ELASTICSEARCH_PASSWORD}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-inputs
  namespace: elastic
  labels:
    k8s-app: filebeat
data:
  kubernetes.yml: |-
    - type: docker
      containers.ids:
      - "*"
      processors:
        - add_kubernetes_metadata:
            in_cluster: true
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: filebeat
  namespace: elastic
  labels:
    k8s-app: filebeat
spec:
  template:
    metadata:
      labels:
        k8s-app: filebeat
    spec:
      serviceAccountName: filebeat
      terminationGracePeriodSeconds: 30
      containers:
      - name: filebeat
        image: docker.elastic.co/beats/filebeat:7.2.0
        args: [
          "-c", "/etc/filebeat.yml",
          "-e",
        ]
        env:
        - name: ELASTICSEARCH_HOST
          value: elasticsearch-master.elastic
        - 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:
        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: inputs
          mountPath: /usr/share/filebeat/inputs.d
          readOnly: true
        - name: data
          mountPath: /usr/share/filebeat/data
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
      volumes:
      - name: config
        configMap:
          defaultMode: 0600
          name: filebeat-config
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
      - name: inputs
        configMap:
          defaultMode: 0600
          name: filebeat-inputs
      # 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
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: filebeat
subjects:
- kind: ServiceAccount
  name: filebeat
  namespace: elastic
roleRef:
  kind: ClusterRole
  name: filebeat
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  name: filebeat
  labels:
    k8s-app: filebeat
rules:
- apiGroups: [""] # "" indicates the core API group
  resources:
  - namespaces
  - pods
  verbs:
  - get
  - watch
  - list
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: filebeat
  namespace: elastic
  labels:
    k8s-app: filebeat

```

* * *

I get data from my Filebeat containers. The problem is that these Filebeat containers appears as hosts in Kibana -\> Infrastructure -\> Hosts

 ![17](https://us1.discourse-cdn.com/elastic/original/3X/3/3/33711a0a12194b12f98085a79cf154b095afcdda.png)

I guess I should have only my Azure nodes here. How can I get rid of these "false" hosts ?

I have these fields in my filebeat index : **host.name** and **kubernetes.node.name**.

![57](https://us1.discourse-cdn.com/elastic/original/3X/6/5/652253baa3f52658b511512262c1fc1981485f2c.png)  
 ![31](https://us1.discourse-cdn.com/elastic/original/3X/1/2/12b633a70f3bb6a1b65d62c9eb8845276d39e03a.png)

- Is it normal that data from my filebeat index appears in Kibana's Infrastructure part, or should it be only data from metricbeat index ? (metricbeats gets correct **host.name** )
- If so, does **host.name** should have the same value than **kubernetes.node.name** in filebeat data ?
- If not, is there a configuration to do on Kibana's side to get hosts values from **kubernetes.node.name** and not from **host.name**?

Feel free to ask my for more details if needed 🙂

---

<div class="post-metadata">

**Author:** ![twiggy](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@twiggy](https://discuss.elastic.co/u/twiggy)\
**Post date:** [July 17, 2019, 1:44pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-host-name-got-the-pod-names-and-not-the-kubernetes-host-name/189951/2 "2019-07-17T13:44:06Z")

</div>

So I'm the only one having this problem out of the box ? 🤔

---

<div class="post-metadata">

**Author:** ![fgabolde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fgabolde/32/50267_2.png) [@fgabolde](https://discuss.elastic.co/u/fgabolde)\
**Post date:** [July 19, 2019, 12:25pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-host-name-got-the-pod-names-and-not-the-kubernetes-host-name/189951/3 "2019-07-19T12:25:24Z")

</div>

This is interesting, I've been having a similar issue with `host.name`: [Filebeat adds a host.name field to JSON messages even when already set](https://discuss.elastic.co/t/filebeat-adds-a-host-name-field-to-json-messages-even-when-already-set/190780)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 16, 2019, 12:29pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-host-name-got-the-pod-names-and-not-the-kubernetes-host-name/189951/4 "2019-08-16T12:29:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
