Before You Begin
Before beginning this guide, you should have:- Created a running Kubernetes cluster.
- Deployed some applications to your cluster and instrumented them with OpenTelemetry.
- Deployed an OpenTelemetry Collector in DaemonSet mode, listening on the Node IP.
Forward Data from Your Application Code to the Collectors
Now that you have a telemetry pipeline in your cluster, you must configure the SDKs to forward the telemetry data to your Collectors. To do this, you will use the Kubernetes Downward API, which allows you to pass information about the wider context of your Kubernetes environment into your deployments and therefore your pods. For example, you can use the Downward API to add environment variables that can store pieces of metadata, like the Cluster name. In our Kubernetes Quick Start, you deployed a DaemonSet-mode Collector listening on the IP address of the node, which is where your SDK must send telemetry data.-
Using the Downward API, create an environment variable and pass in the node’s IP address:
-
Configure the node’s environment variable name and value. In this example, we use .NET’s standard environment variable, which is named
OTEL_EXPORTER_OTLP_ENDPOINT, and set it to the value of the node’s IP address.For a list of OTLP exporter configuration options, visit OpenTelemetry’s Protocol Exporter.