# How does the autodiscover feature in \*Beat work?

**URL:** <https://discuss.elastic.co/t/how-does-the-autodiscover-feature-in-beat-work/172603>\
**Category:** Beats\
**Created:** [March 15, 2019, 8:26pm UTC](https://discuss.elastic.co/t/how-does-the-autodiscover-feature-in-beat-work/172603 "2019-03-15T20:26:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeeppler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeeppler/32/43151_2.png) [@Jeeppler](https://discuss.elastic.co/u/Jeeppler)\
**Post date:** [March 15, 2019, 8:26pm UTC](https://discuss.elastic.co/t/how-does-the-autodiscover-feature-in-beat-work/172603/1 "2019-03-15T20:26:09Z")

</div>

How does the `autodiscover` feature in \*Beat (MetricBeat, FileBeat etc.) work from a technical perspective?

I am especially interested in how it works on Kubernetes?

As far as I understood it the \*Beat, for example MetricBeat will watch pod events and reacts if they meed a predefined condition, such as a specific annotation is present. It will then use the module configuration. The [example configuration for MetricBeat in the documentation](https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-autodiscover.html) is:

```auto
metricbeat.autodiscover:
  providers:
    - type: kubernetes
      include_annotations: ["prometheus.io.scrape"]
      templates:
        - condition:
            contains:
              kubernetes.annotations.prometheus.io.scrape: "true"
          config:
            - module: prometheus
              metricsets: ["collector"]
              hosts: "${data.host}:{data.port}"

```

However, what I do not understand is how does the technology to collect the metrics actually work? Is the \*Beat accessing the pod and injecting the \*Beat executable into the running target container? Or does the autodiscover feature use an exposed HTTP API to collect the metrics and basically just connects to the container via HTTP protocol? Or does it use a completely different approach?

---

<div class="post-metadata">

**Author:** ![Jeeppler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeeppler/32/43151_2.png) [@Jeeppler](https://discuss.elastic.co/u/Jeeppler)\
**Post date:** [April 2, 2019, 5:56pm UTC](https://discuss.elastic.co/t/how-does-the-autodiscover-feature-in-beat-work/172603/2 "2019-04-02T17:56:49Z")

</div>

I still could not find answers to my questions.

---

<div class="post-metadata">

**Author:** ![Jeeppler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeeppler/32/43151_2.png) [@Jeeppler](https://discuss.elastic.co/u/Jeeppler)\
**Post date:** [April 11, 2019, 6:57pm UTC](https://discuss.elastic.co/t/how-does-the-autodiscover-feature-in-beat-work/172603/3 "2019-04-11T18:57:46Z")

</div>

As far as I understood it. The `autodiscover` provider will start a collection runner for the specific module and connect to it via TCP/HTTP to collect the information.

The runner is not getting injected directly into the container. Instead it collects only the metrics accessible from outside the container.

---

<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:** [May 9, 2019, 8:57pm UTC](https://discuss.elastic.co/t/how-does-the-autodiscover-feature-in-beat-work/172603/4 "2019-05-09T20:57:47Z")

</div>

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