<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Set up Beyla on Grafana Labs</title><link>https://grafana.com/docs/beyla/v1.0.x/setup/</link><description>Recent content in Set up Beyla on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/beyla/v1.0.x/setup/index.xml" rel="self" type="application/rss+xml"/><item><title>Run Beyla as a standalone process</title><link>https://grafana.com/docs/beyla/v1.0.x/setup/standalone/</link><pubDate>Sat, 11 Apr 2026 18:21:38 +0000</pubDate><guid>https://grafana.com/docs/beyla/v1.0.x/setup/standalone/</guid><content><![CDATA[&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/beyla-logo-2.png&#34;
  alt=&#34;Grafana Beyla Logo&#34; width=&#34;557&#34;
     height=&#34;220&#34;/&gt;&lt;/p&gt;
&lt;h1 id=&#34;run-beyla-as-a-standalone-process&#34;&gt;Run Beyla as a standalone process&lt;/h1&gt;
&lt;p&gt;Beyla can run as a standalone Linux OS process with elevated privileges that can inspect other running processes.&lt;/p&gt;
&lt;p&gt;For a complete introduction tutorial on how to collect and visualize the instrumented data, follow the &lt;a href=&#34;../../tutorial/&#34;&gt;quick start tutorial&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;download-and-install&#34;&gt;Download and install&lt;/h2&gt;
&lt;p&gt;You can download the Beyla executable from the &lt;a href=&#34;https://github.com/grafana/beyla/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla releases page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Alternatively, download the Beyla executable with the &lt;code&gt;go install&lt;/code&gt; command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;go install github.com/grafana/beyla/cmd/beyla@latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;configure&#34;&gt;Configure&lt;/h2&gt;
&lt;p&gt;Beyla can be configured via:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;environment variables&lt;/li&gt;
&lt;li&gt;a YAML configuration file, supplied with the &lt;code&gt;-config&lt;/code&gt; CLI argument&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the same configuration property is defined in both the YAML file and the environment
variables, the value specified in the environment variables takes precedence over the
configuration file.&lt;/p&gt;
&lt;p&gt;For a complete list of configuration options, see the &lt;a href=&#34;../../configure/&#34;&gt;Beyla configuration options&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h2 id=&#34;run&#34;&gt;Run&lt;/h2&gt;
&lt;p&gt;Beyla requires at least two configuration options to run:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the executable to instrument, specified with the command line name or port&lt;/li&gt;
&lt;li&gt;a metrics exporter, either OpenTelemetry or Prometheus&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Beyla requires administrative (sudo) privileges, or at least it needs to be granted the &lt;code&gt;CAP_SYS_ADMIN&lt;/code&gt; capability.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s instrument the process that owns the port 443, and expose the metrics as a Prometheus endpoint listening on the port 8999. In this example, the configuration is passed exclusively through environment variables:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;BEYLA_PROMETHEUS_PORT=8999 BEYLA_OPEN_PORT=443 sudo -E beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The equivalent execution, but configured via a YAML file would look like:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;cat &amp;gt; config.yml &amp;lt;&amp;lt;EOF
open_port: 443
prometheus_export:
  port: 8999
EOF
sudo beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In the following example, the previous YAML configuration option for the Prometheus port is overridden by an environment variable:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;BEYLA_PROMETHEUS_PORT=8888 sudo -E beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;p>&lt;img
class="lazyload d-inline-block"
data-src="https://grafana.com/media/docs/grafana-cloud/beyla/beyla-logo-2.png"
alt="Grafana Beyla Logo" width="557"
height="220"/>&lt;/p>
&lt;h1 id="run-beyla-as-a-standalone-process">Run Beyla as a standalone process&lt;/h1>
&lt;p>Beyla can run as a standalone Linux OS process with elevated privileges that can inspect other running processes.&lt;/p></description></item><item><title>Run Beyla as a Docker container</title><link>https://grafana.com/docs/beyla/v1.0.x/setup/docker/</link><pubDate>Sat, 11 Apr 2026 18:21:38 +0000</pubDate><guid>https://grafana.com/docs/beyla/v1.0.x/setup/docker/</guid><content><![CDATA[&lt;h1 id=&#34;run-beyla-as-a-docker-container&#34;&gt;Run Beyla as a Docker container&lt;/h1&gt;
&lt;p&gt;Beyla can run a standalone Docker container that can instrument a process running in another container.&lt;/p&gt;
&lt;p&gt;Find the latest image of Beyla on &lt;a href=&#34;https://hub.docker.com/r/grafana/beyla&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Docker Hub&lt;/a&gt; with the following name:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;grafana/beyla:latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The Beyla container must be configured in following way:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;run as a &lt;strong&gt;privileged&lt;/strong&gt; container, or as a container with the &lt;code&gt;SYS_ADMIN&lt;/code&gt; capability&lt;/li&gt;
&lt;li&gt;share the PID space with the container that is being instrumented&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;docker-cli-example&#34;&gt;Docker CLI example&lt;/h2&gt;
&lt;p&gt;For this example you need a container running an HTTP/S or GRPC service. If you don&amp;rsquo;t have one, you can use this &lt;a href=&#34;http://macias.info&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;simple blog engine service written in Go&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;docker run -p 18443:8443 --name goblog mariomac/goblog:dev&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above command runs a simple HTTPS application. The process opens the container&amp;rsquo;s internal port &lt;code&gt;8443&lt;/code&gt;, which is then exposed at the host level as the port &lt;code&gt;18443&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Set environment variables to configure Beyla to print to stdout and listen to a port (container) to inspect the executable:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;export BEYLA_PRINT_TRACES=true
export BEYLA_OPEN_PORT=8443&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Beyla needs to be run with the following settings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;in &lt;code&gt;--privileged&lt;/code&gt; mode, or with &lt;code&gt;SYS_ADMIN&lt;/code&gt; capability&lt;/li&gt;
&lt;li&gt;a container PID namespace, with the option &lt;code&gt;--pid=&amp;quot;container:goblog&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;docker run --rm \
  -e BEYLA_OPEN_PORT=8443 \
  -e BEYLA_PRINT_TRACES=true \
  --pid=&amp;#34;container:goblog&amp;#34; \
  --privileged \
  grafana/beyla:latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Once Beyla is running, open &lt;code&gt;https://localhost:8443&lt;/code&gt; in your browser, use the app to generate test data, and verify that Beyla prints trace requests to stdout similar to:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;time=2023-05-22T14:03:42.402Z level=INFO msg=&amp;#34;creating instrumentation pipeline&amp;#34;
time=2023-05-22T14:03:42.526Z level=INFO msg=&amp;#34;Starting main node&amp;#34;
2023-05-22 14:03:53.5222353 (19.066625ms[942.583µs]) 200 GET / [172.17.0.1]-&amp;gt;[localhost:18443] size:0B
2023-05-22 14:03:53.5222353 (355.792µs[321.75µs]) 200 GET /static/style.css [172.17.0.1]-&amp;gt;[localhost:18443] size:0B
2023-05-22 14:03:53.5222353 (170.958µs[142.916µs]) 200 GET /static/img.png [172.17.0.1]-&amp;gt;[localhost:18443] size:0B
2023-05-22 14:13:47.52221347 (7.243667ms[295.292µs]) 200 GET /entry/201710281345_instructions.md [172.17.0.1]-&amp;gt;[localhost:18443] size:0B
2023-05-22 14:13:47.52221347 (115µs[75.625µs]) 200 GET /static/style.css [172.17.0.1]-&amp;gt;[localhost:18443] size:0B&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now that Beyla is tracing the the target HTTP service, configure it to send metrics and traces to an OpenTelemetry endpoint, or have metrics scraped by Prometheus.&lt;/p&gt;
&lt;p&gt;For information on how to export traces and metrics, see the &lt;a href=&#34;../../tutorial/&#34;&gt;quick start tutorial&lt;/a&gt; and the &lt;a href=&#34;../../configure/options/&#34;&gt;configuration options&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h2 id=&#34;docker-compose-example&#34;&gt;Docker Compose example&lt;/h2&gt;
&lt;p&gt;The following Docker compose file replicates the same functionality of the Docker CLI example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;version: &amp;#34;3.8&amp;#34;

services:
  # Service to instrument. Change it to any
  # other container that you want to instrument.
  goblog:
    image: mariomac/goblog:dev
    ports:
      # Exposes port 18843, forwarding it to container port 8443
      - &amp;#34;18443:8443&amp;#34;

  autoinstrumenter:
    image: grafana/beyla:latest
    pid: &amp;#34;service:goblog&amp;#34;
    cap_add:
      - SYS_ADMIN
    # If using the above capability fails to instrument your service, remove it
    # and uncomment the line below
    # privileged: true
    environment:
      BEYLA_PRINT_TRACES: true
      BEYLA_OPEN_PORT: 8443&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Run the Docker compose file with the following command and use the app to generate traces:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;docker compose -f compose-example.yml up&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="run-beyla-as-a-docker-container">Run Beyla as a Docker container&lt;/h1>
&lt;p>Beyla can run a standalone Docker container that can instrument a process running in another container.&lt;/p>
&lt;p>Find the latest image of Beyla on &lt;a href="https://hub.docker.com/r/grafana/beyla" target="_blank" rel="noopener noreferrer">Docker Hub&lt;/a> with the following name:&lt;/p></description></item><item><title>Deploy Beyla in Kubernetes</title><link>https://grafana.com/docs/beyla/v1.0.x/setup/kubernetes/</link><pubDate>Sat, 11 Apr 2026 18:21:38 +0000</pubDate><guid>https://grafana.com/docs/beyla/v1.0.x/setup/kubernetes/</guid><content><![CDATA[&lt;h1 id=&#34;deploy-beyla-in-kubernetes&#34;&gt;Deploy Beyla in Kubernetes&lt;/h1&gt;
&lt;p&gt;You can deploy Beyla in Kubernetes in two separate ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;As a Sidecar Container (recommended)&lt;/li&gt;
&lt;li&gt;As a DaemonSet&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the future, we will release a &lt;a href=&#34;https://github.com/grafana/beyla-operator&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla operator&lt;/a&gt;
but at the moment it is work in progress and its API is not stable enough.&lt;/p&gt;
&lt;h2 id=&#34;deploying-as-a-sidecar-container&#34;&gt;Deploying as a sidecar container&lt;/h2&gt;
&lt;p&gt;This is the recommended way of deploying Beyla for the following reason:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can configure the auto-instrumentation per instance, instead of having
Beyla monitor all of the service instances on the host.&lt;/li&gt;
&lt;li&gt;You will save on compute and memory resources. If the auto-instrumented service is present only in a subset
of the containers running on the host, you won&amp;rsquo;t need to deploy the auto-instrument tool for all containers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Deploying Beyla as a sidecar container has the following configuration
requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The process namespace must be shared between all containers in the Pod (&lt;code&gt;shareProcessNamespace: true&lt;/code&gt;
pod variable)&lt;/li&gt;
&lt;li&gt;The auto-instrument tool must internally run as privileged user in the container
(&lt;code&gt;securityContext.runAsUser: 0&lt;/code&gt; property in the container configuration).&lt;/li&gt;
&lt;li&gt;The auto-instrument container must run in privileged mode (&lt;code&gt;securityContext.privileged: true&lt;/code&gt; property of the
container configuration) or at least with &lt;code&gt;SYS_ADMIN&lt;/code&gt; capability (`securityContext.capabilities.add: [&amp;ldquo;SYS_ADMIN&amp;rdquo;])&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following example instruments the &lt;code&gt;goblog&lt;/code&gt; pod by attaching Beyla
as a container (image available at &lt;code&gt;grafana/beyla:latest&lt;/code&gt;). The
auto-instrumentation tool is configured to forward metrics and traces to a Grafana Agent,
which is accessible behind the &lt;code&gt;grafana-agent&lt;/code&gt; service in the same namespace:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: goblog
  labels:
    app: goblog
spec:
  replicas: 2
  selector:
    matchLabels:
      app: goblog
  template:
    metadata:
      labels:
        app: goblog
    spec:
      # Required so the sidecar instrument tool can access the service process
      shareProcessNamespace: true
      containers:
        # Container for the instrumented service
        - name: goblog
          image: mariomac/goblog:dev
          imagePullPolicy: IfNotPresent
          command: [&amp;#34;/goblog&amp;#34;]
          env:
            - name: &amp;#34;GOBLOG_CONFIG&amp;#34;
              value: &amp;#34;/sample/config.yml&amp;#34;
          ports:
            - containerPort: 8443
              name: https
        # Sidecar container with Beyla - the eBPF auto-instrumentation tool
        - name: autoinstrument
          image: grafana/beyla:latest
          securityContext: # Privileges are required to install the eBPF probes
            runAsUser: 0
            capabilities:
              add:
                - SYS_ADMIN
          env:
            - name: BEYLA_OPEN_PORT # The internal port of the goblog application container
              value: &amp;#34;8443&amp;#34;
            - name: OTEL_EXPORTER_OTLP_ENDPOINT
              value: &amp;#34;http://grafana-agent:4318&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information about the different configuration options, please check the
&lt;a href=&#34;../../configure/options/&#34;&gt;Configuration&lt;/a&gt; section of this documentation site.&lt;/p&gt;
&lt;p&gt;Deploying as a sidecar container, is the default deployment mode for the
&lt;a href=&#34;https://github.com/grafana/beyla-operator&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;eBPF auto-instrument Kubernetes Operator&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;deploying-as-a-daemonset&#34;&gt;Deploying as a Daemonset&lt;/h2&gt;
&lt;p&gt;Alternatively, you can deploy the auto-instrumentation tool as a DaemonSet. Using the
previous example (the &lt;code&gt;goblog&lt;/code&gt; pod), we cannot select the process to instrument by using
its open port, because the port is internal to the Pod. At the same time multiple instances of the
service would have different open ports. In this case, we will need to instrument by
using the application service executable name (see later example).&lt;/p&gt;
&lt;p&gt;For security reasons, you should not deploy as DaemonSet unless you can be sure
that no external users can deploy pods to the Kubernetes cluster. This is to avoid
deploying a pod with a process whose name collides with the original instrumented
process.&lt;/p&gt;
&lt;p&gt;In addition to the privilege requirements of the sidecar scenario,
you will need to configure the auto-instrument pod template with the &lt;code&gt;hostPID: true&lt;/code&gt;
option enabled, so that it can access all of the processes running on the same host.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: beyla
  labels:
    app: beyla
spec:
  selector:
    matchLabels:
      app: beyla
  template:
    metadata:
      labels:
        app: beyla
    spec:
      hostPID: true # Require to access the processes on the host
      containers:
        - name: autoinstrument
          image: grafana/beyla:latest
          securityContext:
            runAsUser: 0
            privileged: true # Alternative to the capabilities.add SYS_ADMIN setting
          env:
            - name: BEYLA_EXECUTABLE_NAME # Select the executable by its name instead of BEYLA_OPEN_PORT
              value: &amp;#34;goblog&amp;#34;
            - name: OTEL_EXPORTER_OTLP_ENDPOINT
              value: &amp;#34;http://grafana-agent:4318&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="deploy-beyla-in-kubernetes">Deploy Beyla in Kubernetes&lt;/h1>
&lt;p>You can deploy Beyla in Kubernetes in two separate ways:&lt;/p>
&lt;ul>
&lt;li>As a Sidecar Container (recommended)&lt;/li>
&lt;li>As a DaemonSet&lt;/li>
&lt;/ul>
&lt;p>In the future, we will release a &lt;a href="https://github.com/grafana/beyla-operator" target="_blank" rel="noopener noreferrer">Beyla operator&lt;/a>
but at the moment it is work in progress and its API is not stable enough.&lt;/p></description></item></channel></rss>