Sending Telemetry Data to the OpenTelemetry Collector with Sidecar Injection
You can configure the Alauda build of OpenTelemetry v2 to inject the OpenTelemetry Collector as a sidecar container into your application pods. The sidecar Collector runs in the same pod as your application, enabling applications to send telemetry data to the Collector via localhost without complex network configuration.
The Operator does not create Service, Ingress, NetworkPolicy, or HorizontalPodAutoscaler resources for a Collector in sidecar mode, because it does not own the pod lifecycle in that mode. Applications reach the sidecar over localhost; if its ports must be reachable from outside the pod, expose them through the application's own Service.
Prerequisites
- Alauda build of OpenTelemetry v2 Operator is installed.
- Alauda Build of Jaeger v2 is installed and deployed.
- An active ACP CLI (
kubectl) session by a cluster administrator with thecluster-adminrole.
Procedure
-
Deploy the OpenTelemetry Collector as a sidecar by running the following command:
- Replace
<image-registry>/asm/opentelemetry-collector:<image-tag>with the actual image registry and tag for the sidecar Collector. - The OTLP gRPC exporter is named
otlp_grpc. The former nameotlpstill works but is deprecated. Note that the OTLP receiver keeps the nameotlp; see Component type names. - Replace
jaeger-<example>-collectorwith the actual service name of your Alauda Build of Jaeger v2 collector. The format is typically<instance-name>-collector.
- Replace
-
Create a deployment that uses the sidecar injection by adding the annotation
sidecar.opentelemetry.io/inject: "true"and using the created ServiceAccount: