Skip to content

Deploy OpenTelemetry Collector

This example uses OpenTelemetry Collector, a vendor-agnostic implementation of how to receive, process and export telemetry data. OpenTelemetry Collector can be used with Unikraft / Unikraft Cloud to work with telemetry data.

To run this example, follow these steps:

  1. Install the kraft CLI tool and a container runtime engine, e.g. Docker.

  2. Clone the examples repository and cd into the examples/opentelemetry-collector/ directory:

Terminal window
git clone https://github.com/kraftcloud/examples
cd examples/opentelemetry-collector/

Make sure to log into Unikraft Cloud by setting your token and a metro close to you. We use fra0 (Frankfurt, 🇩🇪) in this guide:

Terminal window
# Set Unikraft Cloud access token
export UKC_TOKEN=token
# Set metro to Frankfurt, DE
export UKC_METRO=fra0

When done, invoke the following command to deploy this application on Unikraft Cloud:

Terminal window
kraft cloud deploy -M 1024M .

The output shows the instance URL and other details:

Terminal window
[] Deployed successfully!
────────── name: opentelemetry-collector-bvtnh
────────── uuid: 40e8b154-b3b6-4312-ae69-2cdb794b15e4
───────── state: starting
───────── image: opentelemetry-collector@sha256:64f73ea5fe208f54e5212f57979f24bebcf36276495462c52b380d15dd539ced
──────── memory: 976 MiB
── private fqdn: opentelemetry-collector-bvtnh.internal
──── private ip: 172.16.3.3
────────── args: /usr/bin/otelcontribcol --config /etc/otel/config.yaml

In this case, the instance name is opentelemetry-collector-bvtnh. They are different for each run.

Note that the instance does not export a service. The default configuration can receive telemetry data from other instances by specifying the private IP or internal DNS as destination. The only configured exporter is the debug exporter. Feel free to modify and redeploy!

At any point in time, you can list information about the instance:

Terminal window
kraft cloud instance list
razvand@mantis:~/.../examples/opentelemetry-collector$ kraft cloud inst ls
NAME FQDN STATE STATUS IMAGE MEMORY ARGS BOOT TIME
opentelemetry-collector-bvtnh running since 11mins opentelemetry... 976 MiB /usr/bin/otelcontribcol --config... 177.62 ms

When done, you can remove the instance:

Terminal window
kraft cloud instance remove opentelemetry-collector-bvtnh

Customize your Application

To customize the OpenTelemetry Collector application, update Kraftfile or, more likely, the rootfs/etc/otel/config.yaml files:

spec: v0.6
runtime: opentelemetry-collector:latest
rootfs: ./rootfs

You can update the rootfs/etc/otel/config.yaml file as detailed in the documentation. Such as adding another export, apart from the debug exporter.

Learn More

Use the --help option for detailed information on using Unikraft Cloud:

Terminal window
kraft cloud --help

Or visit the CLI Reference.