Skip to content

Collector Deployment Patterns and Kubernetes: OTCA practice questions

The Collector ships as a single binary, and the documentation describes several ways to place it. In the simplest arrangement there is no Collector at all: each SDK exports straight to a backend.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Collector Deployment Patterns and Kubernetes covers in OTCA

The Collector ships as a single binary, and the documentation describes several ways to place it. In the simplest arrangement there is no Collector at all: each SDK exports straight to a backend. That is quick to set up and has no extra moving parts, but any change to collection or processing means changing application code, the application becomes coupled to the backend, and each language offers only a limited set of exporters.

In the agent pattern, the application sends OTLP to a Collector running next to it or on the same host, typically as a sidecar or a DaemonSet in Kubernetes. The docs list its strengths as being easy to start and giving a clear one-to-one mapping between application and Collector, and its weaknesses as limited scalability and inflexibility for complex or evolving setups.

In the gateway pattern, applications or agents send to a single OTLP endpoint served by one or more standalone Collector instances, often one endpoint per cluster, data center or region. Its benefits are separation of concerns, such as credentials managed in one place, and central policy for filtering or sampling. The costs are another component that can fail, added latency when Collectors are chained, and higher resource use. When data must reach one particular Collector, as tail sampling needs, the docs describe a two-tier gateway: the first tier runs the load-balancing exporter so that every span of a trace lands on the same second-tier instance.

On Kubernetes there are two official installation paths. The OpenTelemetry Operator, which needs cert-manager installed first, manages Collectors through the OpenTelemetryCollector custom resource and also handles auto-instrumentation. Its spec.mode can be deployment, daemonset, statefulset or sidecar, and deployment is the default. Sidecar mode injects the Collector into pods that carry the sidecar.opentelemetry.io/inject annotation, which belongs on the pod template rather than on the Deployment object. The Helm chart is the other path. It requires mode to be set to daemonset, deployment or statefulset and offers presets that wire up RBAC, volumes and components. For example, the cluster metrics preset is recommended with a single-replica deployment, because several copies of the cluster receiver would emit duplicate data.

Whatever the topology, the Kubernetes attributes processor is the key enrichment step for application telemetry. It watches pods through the Kubernetes API and, by default, matches incoming data to a pod by the connection IP, then adds resource attributes such as k8s.pod.name and k8s.namespace.name. Agents should restrict discovery to their own node with filter.node_from_env_var and a node name injected through the downward API. When a gateway sits behind agents, the agents can run the processor in passthrough mode so the original pod IP travels with the data.

Key points

  • No Collector is simplest, but processing changes then require application code changes.
  • An agent runs beside the workload, such as a sidecar or DaemonSet; a gateway is a shared standalone endpoint.
  • Tail sampling behind a gateway needs a first tier with the load-balancing exporter routing by trace ID.
  • The Operator OpenTelemetryCollector resource supports deployment, daemonset, statefulset and sidecar modes, with deployment as the default.
  • The Helm chart requires mode to be daemonset, deployment or statefulset.
  • The k8sattributes processor associates data with pods by connection IP unless other rules are configured.

Three sample questions

17 OTCA questions on Collector Deployment Patterns and Kubernetes, 17 with explanations. How practice works

Question 1

In the documented agent deployment pattern, where does the Collector that first receives an application's OTLP data run?
  1. A.Alongside the application or on the same host, such as a sidecar or DaemonSet
  2. B.In a central regional cluster behind an external load balancer only
  3. C.Inside the application process as a library loaded by the SDK
  4. D.In the observability backend, which embeds the Collector receivers

Correct answer: A

The agent pattern page says signals are sent to a Collector instance that runs alongside the application or on the same host, such as a sidecar or DaemonSet. The SDK is configured with the address of that Collector, which then sends data to one or more backends. Why the other options are wrong. "In a central regional cluster behind an external l…": a central endpoint behind a load balancer describes the gateway pattern. "Inside the application process as a library loaded…": the Collector is a separate executable, not a library inside the application process. "In the observability backend, which embeds the Col…": the pattern places the Collector next to the workload, not inside the backend.

Sources: OpenTelemetry docs: Agent deployment pattern, OpenTelemetry docs: Collector architecture

Question 2

According to the gateway deployment pattern page, which of these is listed as a benefit (pro) of the gateway pattern?
  1. A.Lower latency, because data skips the extra Collector hop
  2. B.Lower overall resource usage than an agent-only setup
  3. C.Separation of concerns, e.g. centrally held credentials
  4. D.Fewer moving parts to maintain than sending data directly

Correct answer: C

The gateway page lists as pros separation of concerns such as centrally managed credentials, and centralized policy management (for example filtering certain logs or sampling). Its cons are extra complexity, added latency with cascaded collectors, and higher overall resource usage. Why the other options are wrong. "Lower latency, because data skips the extra Collec…": added latency in case of cascaded collectors is listed as a con. "Lower overall resource usage than an agent-only se…": higher overall resource usage (costs) is listed as a con. "Fewer moving parts to maintain than sending data d…": "one more thing to maintain and that can fail" is listed as a con.

Sources: OpenTelemetry docs: Gateway deployment pattern, OpenTelemetry docs: Deploy the Collector

Question 3

A team exports traces, metrics and logs straight from each service's SDK to a vendor backend with no Collector. Which drawback does the No Collector pattern page list?
  1. A.Applications cannot use OTLP at all unless a Collector is in the path
  2. B.Logs cannot be exported unless a Collector is deployed
  3. C.Telemetry is always sampled at 10% by the SDK by default
  4. D.Changing collection or processing needs requires code changes

Correct answer: D

The No Collector page lists its cons as: code changes are required if collection, processing or ingestion needs change; strong coupling between application code and the backend; and each language implementation supports only a limited number of exporters. Its pros are simplicity, especially in development and test, and no extra moving parts. Why the other options are wrong. "Applications cannot use OTLP at all unless a Colle…": SDKs export OTLP directly to backends in this pattern; the page shows signals going straight to a backend. "Telemetry is always sampled at 10% by the SDK by d…": no default 10% SDK sampling is mentioned; the page is about coupling and code changes. "Logs cannot be exported unless a Collector is depl…": the page states traces, metrics and logs are all exported straight to a backend.

Sources: OpenTelemetry docs: No Collector deployment pattern, OpenTelemetry docs: Agent deployment pattern

Practice this topic

Focus mode keeps every question on Collector Deployment Patterns and Kubernetes until you leave it. 10 free guest answers, then a free account; no credit card.

Or open OTCA practice across all topics.

Sources

The explanation above was checked against these official documents.

Frequently asked questions

Where does the sidecar injection annotation go for a Deployment?

On the pod template metadata. The Operator docs mark an annotation on the Deployment object itself as wrong.