# Metricbeat system hostfs will stuck the pod from terminating

**URL:** <https://discuss.elastic.co/t/metricbeat-system-hostfs-will-stuck-the-pod-from-terminating/125343>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [March 23, 2018, 10:14am UTC](https://discuss.elastic.co/t/metricbeat-system-hostfs-will-stuck-the-pod-from-terminating/125343 "2018-03-23T10:14:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wklken](https://avatars.discourse-cdn.com/v4/letter/w/cab0a1/32.png) [@wklken](https://discuss.elastic.co/u/wklken)\
**Post date:** [March 23, 2018, 10:14am UTC](https://discuss.elastic.co/t/metricbeat-system-hostfs-will-stuck-the-pod-from-terminating/125343/1 "2018-03-23T10:14:35Z")

</div>

hi:

We ran metricbeat as a daemonset in kubernetes.

I wonder has this issue been reported before. (I searched and found nothing)

And we found a lot of pods stucking in terminating step; We do a dig and it's the metricbeat mount case the pod from gc, (This will case all update operations in k8s will be stucked).

and sometimes the pod will be terminated normally.

```auto
$ grep -r e68c3f3b-2d9f-11 e8-bebd-00e081e67186 /proc/*/mounts 

/proc/82193/mounts:tmpfs /hostfs/data/kubernetes/var/lib/kubelet /pods/e68c3f3b-2d9f-11e8-bebd-00e081e67186/volumes/kubernetes.io~secret/defa ult-token-44tfx tmpfs rw,relatime 0 0

$ cat /proc/82193/cmdline
metricbeat -e -system.hostfs=/hostfs

```

the configmap (with system.yml)

```auto
apiVersion: v1
data:
  kubernetes.yml: |
    - module: kubernetes
      metricsets:
        - node
        - system
        - pod
        - container
        - volume
      period: 30s
      hosts: ["localhost:10255"]
  system.yml: |-
    - module: system
      metricsets:
        - cpu
        - load
        - memory
        - network
      interfaces: [eth0,cni0,flannel.1]
      enabled: true
      period: 30s
      processes: ['.*']
      processors:
    - module: system
      metricsets:
        - diskio
      enabled: true
      period: 30s
      processors:
      - drop_event.when.not.equals:
          system.diskio.name: 'xvda1'
    - module: system
      period: 1m
      metricsets:
        - filesystem
      filesystem.ignore_types: [proc,sysfs,tmpfs,binfmt_misc]
      processors:
      - drop_event.when.not.equals:
          system.filesystem.mount_point: '/hostfs'
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: metricbeat-node-config

```

and the metricbeat run as daemonset, the command line

```auto
metricbeat -e -system.hostfs=/hostfs

the volume mount

      volumeMounts:
        - name: config-volume
          mountPath: /usr/share/metricbeat/modules.d
          readOnly: true
        - name: dockersock
          mountPath: /var/run/docker.sock
          readOnly: true
        - name: proc
          mountPath: /hostfs/proc
          readOnly: true
        - name: fscgroup
          mountPath: /hostfs/sys/fs/cgroup
          readOnly: true
        - name: hostfs
          mountPath: /hostfs
          readOnly: true
        securityContext:
          runAsUser: 0
      terminationGracePeriodSeconds: 30
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      volumes:
      - name: config-volume
        configMap:
          name: metricbeat-node-config
      - name: hostfs
        hostPath:
          path: /
      - name: proc
        hostPath:
          path: /proc
      - name: fscgroup
        hostPath:
          path: /sys/fs/cgroup
      - name: dockersock
        hostPath:
          path: /var/run/docker.sock

```

Why metricbeat mount the pod's path? and when it release the mount?

The metricbeat do a great help in k8s, so we want to find some clues to solve the issue.

Thank you.

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [March 23, 2018, 9:44pm UTC](https://discuss.elastic.co/t/metricbeat-system-hostfs-will-stuck-the-pod-from-terminating/125343/2 "2018-03-23T21:44:48Z")

</div>

Hi @wklken,

I noticed this:

> [@wklken](#):
>
> - name: hostfs  
> hostPath:  
> path: /

Why do you mount your whole root filesystem under /hostfs? normally metricbeat only needs access to `/proc` and `/sys/fs/cgroup`

Best regards

---

<div class="post-metadata">

**Author:** ![wklken](https://avatars.discourse-cdn.com/v4/letter/w/cab0a1/32.png) [@wklken](https://discuss.elastic.co/u/wklken)\
**Post date:** [March 24, 2018, 2:36am UTC](https://discuss.elastic.co/t/metricbeat-system-hostfs-will-stuck-the-pod-from-terminating/125343/3 "2018-03-24T02:36:12Z")

</div>

Diff with the official config yaml: [https://github.com/elastic/beats/blob/master/deploy/kubernetes/metricbeat/metricbeat-daemonset.yaml](https://github.com/elastic/beats/blob/master/deploy/kubernetes/metricbeat/metricbeat-daemonset.yaml)

I think that is the reason and I will test in a k8s cluster later.( still don't know why and when the mount be import to the config file and apply into the cluster \>\_\<# )

thanks a lot! @exekias

---

<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:** [April 21, 2018, 2:36am UTC](https://discuss.elastic.co/t/metricbeat-system-hostfs-will-stuck-the-pod-from-terminating/125343/4 "2018-04-21T02:36:26Z")

</div>

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