Deployment patterns

  • Compare SDK direct export, Pod sidecars, node agents and a shared gateway.
100%
Workload nodeApplication PodShared gateway tierChoose the first hop and the policy ownerTelemetry transferdirectgateway onlynode-localloopbackforwardforwardconnectionexportApplicationOTel SDKPod sidecarCollectorNode agentDaemonSetService or LBOTLP endpointCollectorreplicasTelemetrybackenddirectgateway onlynode-localloopbackforwardforwardconnectionexport

Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.

  • Each arrow leaving the application is an alternative. Its first destination can be the backend itself, a Collector in the same Pod, one on the same node, or a shared gateway.
  • A sidecar belongs to one Pod. A DaemonSet places an agent on each selected Kubernetes node. A gateway is a separate pool of Collectors behind a shared network address.
  • For 30 application Pods on three nodes, one sidecar per Pod adds 30 Collectors. One agent per node adds three, and an agent outage then affects the senders on that node.
  • Choose a first hop for the SDK. The four outgoing paths are deployment alternatives.
  • The sidecar and node-agent examples forward to a shared gateway. Either can export directly when its local policy is sufficient.
Collector deployment choices

Collector deployment choices

OpenTelemetry Collector Contrib 0.136.0

Place the first network hop

First destination Owner and useful property Failure and cost
Backend Each SDK exports directly using its own endpoint, credentials and batch policy. Backend changes reach every producer. Finite SDK buffering can lose data during an outage.
Sidecar The app sends OTLP over Pod loopback. The workload can choose its release and budget. One Collector per Pod adds CPU and memory. Replacing the Pod takes both endpoints down.
Node agent A DaemonSet shares local file/host collection across Pods on a node. A node failure or agent saturation affects its local senders. Host mounts and permissions need explicit scope.
Gateway SDKs use a shared endpoint backed by Collector replicas. Backend credentials and routing can be managed centrally. Applications depend on reachability of that service. A shared gateway can couple tenants or zones.
  • An agent can send to a gateway when both node-local collection and centralized export policy matter. Each additional hop owns its own buffers, retry policy and capacity.

Connect one application

  • The Pod fragment selects gRPC on loopback. A configured SDK and a sidecar listening on port 4317 in the same Pod are prerequisites.
  • For node-local collection, select the local node endpoint explicitly. A normal Service address can select an agent on another node. Plan listener binding, credentials and pod-to-node routing together.
  • The sidecar forwards traces, metrics and logs to the gateway using its own client certificate. Configure the gateway certificate, sender trust roots and authorized network access before starting the pair.
  • Validate TLS identities and authorize senders at the trust boundary. A workload-supplied service or tenant attribute alone cannot establish caller identity.
Send OTLP to a Pod-local Collectoryaml
# Kubernetes Pod container env fragment for an OTLP-capable SDK.
# This form uses a Collector sidecar listening in the same Pod.
env:
  - name: OTEL_SERVICE_NAME
    value: order-api
  - name: OTEL_EXPORTER_OTLP_PROTOCOL
    value: grpc
  - name: OTEL_EXPORTER_OTLP_ENDPOINT
    value: http://127.0.0.1:4317
# For a node agent, select a reachable Collector on THIS node.
# For a gateway or direct backend, select its TLS endpoint and trust roots.
# Configure supported SDK signal exporters for the application separately.
Forward Pod telemetry to a gateway over mutual TLSyaml
# Collector Contrib 0.136.0. Sidecar for the Pod-local SDK example.
# The process accepts telemetry on Pod loopback. Install credentials for
# the shared gateway and supply its DNS endpoint before starting the sidecar.
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 127.0.0.1:4317
processors:
  batch: {}
exporters:
  otlp/gateway:
    endpoint: gateway.example.invalid:4317
    tls:
      ca_file: /etc/otel/tls/gateway-ca.crt
      cert_file: /etc/otel/tls/agent.crt
      key_file: /etc/otel/tls/agent.key
service:
  pipelines:
    traces: {receivers: [otlp], processors: [batch], exporters: [otlp/gateway]}
    metrics: {receivers: [otlp], processors: [batch], exporters: [otlp/gateway]}
    logs: {receivers: [otlp], processors: [batch], exporters: [otlp/gateway]}

Select capacity and failure scope

  • Sidecar cost grows with Pod replicas. Node-agent cost grows with nodes. Size shared gateways for signal volume, processing and downstream acceptance.
  • An established gRPC connection can keep sending to the same gateway replica. Inspect per-replica traffic and queue occupancy after scaling.
  • Assign each scrape target or node log file to one collection owner. Two independent owners reading the same source can produce duplicate observations.