How does the autodiscover feature in *Beat work?

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 is:

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?

I still could not find answers to my questions.

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.

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