# Kubernetes autodiscover fails if filebeat cannot determine its node name

**URL:** https://discuss.elastic.co/t/kubernetes-autodiscover-fails-if-filebeat-cannot-determine-its-node-name/260375
**Category:** Beats
**Tags:** filebeat
**Created:** [January 6, 2021, 5:26pm UTC](https://discuss.elastic.co/t/kubernetes-autodiscover-fails-if-filebeat-cannot-determine-its-node-name/260375 "2021-01-06T17:26:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![smacl](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@smacl](https://discuss.elastic.co/u/smacl)
#### Post date: [January 6, 2021, 5:26pm UTC](https://discuss.elastic.co/t/kubernetes-autodiscover-fails-if-filebeat-cannot-determine-its-node-name/260375/1 "2021-01-06T17:26:22Z")

</div>

Hi,

We are (rarely) seeing an issue using the k8s autodiscover feature in filebeat 7.9.1.

If the API server is unavailable when filebeat tries to determine which node it's running on, filebeat might report an error like the following:

```auto
{"level":"error","timestamp":"2021-01-05T09:10:12.114Z","logger":"autodiscover.pod","caller":"kubernetes/util.go:117","message":"kubernetes: Querying for pod failed with error: Get \"{API_SERVER}/api/v1/namespaces/monitoring/pods/filebeat-ds-j6tfs\": dial tcp: i/o timeout"}

```

When this happens, no pod events seem to be detected and no logs are shipped.

From the code, it looks like the `DiscoverKubernetesNode()` function will return `localhost` in this error case, which is then used as the watch filter for pod/node events.

Is it possible to either retry or fail to start up entirely on a node discovery failure?

Cheers,  
Scott

---

<div class="post-metadata">

### Author: ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)
#### Post date: [January 7, 2021, 3:18pm UTC](https://discuss.elastic.co/t/kubernetes-autodiscover-fails-if-filebeat-cannot-determine-its-node-name/260375/2 "2021-01-07T15:18:59Z")

</div>

Hi!

There is something similar that was coved for `add_kubernetes_metadata` processor initialisation at [https://github.com/elastic/beats/pull/16373](https://github.com/elastic/beats/pull/16373). Feel free to create a Github issue for this case and provide information for your problem so as the team to evaluate this feature.

C.

---

<div class="post-metadata">

### Author: ![smacl](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@smacl](https://discuss.elastic.co/u/smacl)
#### Post date: [January 7, 2021, 5:29pm UTC](https://discuss.elastic.co/t/kubernetes-autodiscover-fails-if-filebeat-cannot-determine-its-node-name/260375/3 "2021-01-07T17:29:37Z")

</div>

Thanks for the quick response Chris!  
I just created [https://github.com/elastic/beats/issues/23400](https://github.com/elastic/beats/issues/23400)

Cheers,  
Scott

---

<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: [February 4, 2021, 7:29pm UTC](https://discuss.elastic.co/t/kubernetes-autodiscover-fails-if-filebeat-cannot-determine-its-node-name/260375/4 "2021-02-04T19:29:45Z")

</div>

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