The OpenTelemetry Operator for Kubernetes

The OpenTelemetry Operator for Kubernetes

A complete, plain-language guide to the Kubernetes Operator that deploys and manages OpenTelemetry Collectors, injects automatic instrumentation into your workloads, and keeps telemetry pipelines healthy as your cluster grows.

Imagine you run a large hotel. Every room needs fresh towels, working lights and a clean bed, and every guest needs a key card that opens only their own door. You could walk the corridors yourself and do each job by hand, but as the hotel grows from ten rooms to a thousand, that stops being possible. So you hire a building manager who knows exactly what a healthy room looks like, checks every room continuously, and quietly fixes anything that drifts from the standard.

The OpenTelemetry Operator is that building manager for your telemetry. In a Kubernetes cluster full of changing workloads, it makes sure collectors are running with the right settings, that applications get instrumented without code changes, and that the whole pipeline keeps matching the description you wrote. This post explains what it is, how it works inside, which parts matter most in production, and which mistakes to avoid, starting from first principles so that no earlier knowledge is needed.

1First, What Is a Kubernetes Operator?

Before we meet the OpenTelemetry Operator, we need to understand the general idea of an operator, because everything else builds on it.

Kubernetes in One Paragraph

Kubernetes is a system that runs containers across many machines. You describe what you want, for example “keep three copies of this application running,” and Kubernetes keeps working until reality matches the description. Each kind of thing it manages, such as a Pod, a Deployment or a Service, is called a resource. You write the desired state in a file and give it to the cluster, and the cluster’s built-in controllers do the rest.

Simple Analogy

A thermostat is a good picture of this. You set the wanted temperature, and the thermostat keeps checking the room and switching the heating on or off until the room matches your setting. Kubernetes controllers behave like thermostats for your applications.

Custom Resources and Controllers

Kubernetes lets you invent new kinds of resources through something called a Custom Resource Definition, usually shortened to CRD. A CRD teaches the cluster a new word, such as “OpenTelemetryCollector.” Once the word exists, people can write short descriptions that use it. But a description alone does nothing, so a custom controller is also needed. The controller watches for these descriptions and takes real action, such as creating Pods, Services and configuration files that match them.

The Operator Idea

An operator is simply a custom controller together with the custom resources it understands, packaged to capture the knowledge of a human expert. The word comes from the idea of a human operator, someone who knows how to install, configure, upgrade and repair a complicated piece of software. The operator turns that expert’s checklist into code that runs inside the cluster all day and night.

Term 1

Resource

A kind of object Kubernetes manages, such as a Pod, Service or Deployment, described in a short file.

Term 2

Custom Resource Definition

A way to add a new resource type to the cluster so that people can describe new kinds of things.

Term 3

Controller

A program that watches resources and acts until the real world matches the written description.

Term 4

Operator

A controller plus custom resources that encode expert knowledge for running a specific piece of software.

Term 5

Reconciliation

The repeating loop in which the controller compares desired state with actual state and fixes any difference.

Term 6

Admission Webhook

A hook the cluster calls when an object is being created, letting a program approve, reject or modify it first.

i
Remember

The key phrase to hold onto is “desired state.” You do not tell an operator the steps to follow. You tell it the end result you want, and it works out the steps and keeps repeating them whenever something drifts.

2What the OpenTelemetry Operator Is and Why It Exists

The OpenTelemetry Operator is a Kubernetes operator from the OpenTelemetry project that manages two big jobs: running Collectors and injecting automatic instrumentation.

A Short Reminder of OpenTelemetry

OpenTelemetry is an open standard for producing and moving telemetry, which means traces, metrics and logs. Applications are instrumented, either by developers or by agents, so they emit this data. A component called the Collector receives the data, processes it and sends it to one or more storage and analysis tools. The standard is neutral, so you can change backends without rewriting your applications.

The Two Problems the Operator Solves

Running OpenTelemetry on Kubernetes by hand creates two repeating chores. The first is deploying and maintaining Collectors, which means writing Deployments, DaemonSets, ConfigMaps and Services, keeping them in sync, and updating them safely. The second is instrumenting applications, which usually means changing images, adding agents and setting many environment variables in every service. Both chores are repetitive and easy to get subtly wrong when multiplied across many teams.

Simple Analogy

Without the operator, setting up telemetry is like cooking for a thousand guests with a single recipe card and one pair of hands. With the operator, you have a kitchen manager who reads the same card, cooks every dish the same way, and notices when one pot starts to boil over.

Job One: Manage Collectors

You describe a collector in a single OpenTelemetryCollector resource. The operator creates and updates the Pods, configuration and Services needed to run it, in the mode you choose.

Job Two: Inject Auto-Instrumentation

You describe how instrumentation should behave in an Instrumentation resource, then add an annotation to a workload. The operator modifies new Pods so that the matching agent is loaded automatically.

Supporting Jobs

The operator can also help with Prometheus target distribution through the Target Allocator, and with remote management of collectors through an OpAMP bridge, as later chapters explain.

Declare
Write what you want
Reconcile
Operator makes it true
Repeat
Drift is corrected

Who Benefits Most

Platform teams benefit the most, because they can offer a standard telemetry service to many product teams without touching each application. Product teams benefit because they get telemetry with little effort. Security and operations teams benefit because configuration is visible, reviewable and consistent. Small teams with a single application may find the operator more machinery than they need, a point we return to when discussing trade-offs.

Where the Operator Lives and Who Maintains It

The operator is an open-source project maintained by the OpenTelemetry community, developed in its own repository and released under a permissive licence. Because it follows the same community process as the rest of OpenTelemetry, its releases, bug fixes and documentation evolve in the open. This also means features can change between versions, which is why reading release notes and pinning versions matter so much in practice.

What the Operator Is Not

It helps to be clear about the boundaries. The operator is not a place to store or look at telemetry, so you still need a backend such as a tracing store, a metrics database or a logging platform. It is not a replacement for the Prometheus Operator, although it can work alongside it and reuse the same monitor resources. It is also not a magic switch that makes every application perfectly observable, because automatic instrumentation captures common activity but cannot understand your business.

Not a

Backend

It moves and manages telemetry but does not store, index or visualise it.

Not a

Dashboard

You still need a tool to draw charts, run searches and raise alerts from the data.

Not a

Replacement for Design

You still decide what to measure, what to sample and what to keep, and the operator only applies those decisions consistently.

Not a

Service Mesh

It does not route traffic or enforce network policy, even though it can inject containers into Pods in a similar way.

Operator versus a Plain Helm Chart

A common question is whether a Helm chart for the Collector is enough. A chart renders templates once and installs the result. It is excellent for simple, predictable installs. An operator keeps running after installation, watching for drift and reacting to changes, and it can take actions at runtime, such as modifying Pods through webhooks. The right choice depends on how much runtime behaviour you need.

QuestionHelm Chart for CollectorOpenTelemetry Operator
Does it keep reconciling after install?No, only when you run an upgradeYes, continuously
Can it inject agents into application Pods?NoYes, through webhooks
Can it distribute Prometheus targets?Not by itselfYes, with the Target Allocator
How complex is it to run?SimpleModerate, with extra components
Best forOne or two standard collectorsMany collectors and many instrumented services
Simple Analogy

A Helm chart is like a furniture kit with a manual. You assemble it once and it stays as built. An operator is like a live-in carpenter who keeps checking that every piece is still tight, and who repairs it the moment something wobbles.

3Architecture and Core Components

Understanding the moving parts makes every later decision easier, especially when something goes wrong at three in the morning.

The Big Picture

The operator itself runs as a Deployment inside your cluster, usually in its own namespace. It contains a controller manager that runs several reconcilers, one for each custom resource type, and a webhook server that receives calls from the Kubernetes API server. It talks to the cluster API to read your descriptions and to create or update the objects needed to match them.

flowchart TD
  U["You apply custom resources"] --> API["Kubernetes API server"]
  API --> W["Operator webhook server"]
  API --> C["Operator controller manager"]
  C --> R1["Collector reconciler"]
  C --> R2["Instrumentation handling"]
  C --> R3["Target Allocator reconciler"]
  R1 --> O1["Deployments, DaemonSets, StatefulSets, ConfigMaps, Services"]
  R3 --> O2["Target Allocator workload"]
  W --> P["Pod mutation for sidecars and agents"]
        
FIG 1 — The operator’s main parts and the objects it produces

The Custom Resources

ResourcePurposeTypical Owner
OpenTelemetryCollectorDescribes a collector, its mode, its image and its pipeline configurationPlatform team
InstrumentationDescribes how auto-instrumentation should be configured for workloads in a namespacePlatform team or application team
OpAMPBridgeConnects managed collectors to a remote management server using the OpAMP protocolPlatform team
Target Allocator settingsConfigured inside the collector resource to distribute Prometheus scrape workPlatform team

The Webhooks

Admission webhooks are the secret behind the operator’s most magical features. When a new Pod is about to be created, the API server pauses and asks the operator’s mutating webhook if it wants to change the Pod. If the Pod carries an instrumentation or sidecar annotation, the webhook adds extra containers, volumes and environment variables on the spot. The Pod then starts already modified, and the application’s own manifest never has to change.

The operator also uses validating webhooks, which check that your descriptions make sense before they are accepted. For example, a collector resource with an invalid mode can be rejected immediately with a clear message, rather than failing quietly later.

Simple Analogy

A mutating webhook is like a friendly security desk at the hotel entrance. Every new guest gets stopped for a moment, and if they qualify, they are handed a key card, a map and a welcome pack before walking in. The guest did nothing special, yet arrives fully equipped.

Certificates and Trust

The API server only talks to webhooks over secure connections, so the operator needs valid certificates. In the usual setup a tool called cert-manager creates and renews them automatically. The operator can also generate its own certificates in some configurations, which is helpful in simple clusters but gives you less control over rotation and trust.

!
Common Mistake

Forgetting that webhooks sit in the path of Pod creation. If the operator is down and the webhook is configured to fail closed for the Pods it covers, new Pods may be blocked. Plan the operator’s availability and the webhook failure behaviour deliberately, instead of discovering them during an outage.

The Reconciliation Loop in Detail

Every reconciler follows the same rhythm. First, it is woken up because something changed, such as a new custom resource, an edited one, or a change in one of the objects it created. Second, it reads the current description and works out what the world should look like. Third, it looks at what actually exists. Fourth, it creates, updates or deletes objects to close the gap. Finally, it records the outcome and goes back to waiting. This loop is safe to repeat, because running it twice with no changes does nothing.

1

Wake up on a change

A watch on the cluster notifies the controller when a collector resource or one of its owned objects changes.

2

Compute the desired objects

The controller turns the description into the exact list of ConfigMaps, workloads and Services that should exist.

3

Compare with reality

It reads the objects that currently exist and finds missing ones, outdated ones and ones that should no longer exist.

4

Apply the difference

It creates, updates or removes objects so that reality matches the description, and then reports status.

Ownership and Automatic Cleanup

Every object the operator creates carries an owner reference that points back to the collector resource. Kubernetes uses this link for garbage collection. If you delete the collector resource, all objects it owns are removed automatically, with no leftover ConfigMaps or Services. It also tells you at a glance which resource is responsible for any given object, which helps a great deal when debugging.

Status and Leader Election

The operator writes information back to the resource’s status, such as the version of the Collector in use and how many replicas are ready. This lets you check health with a simple query instead of searching through Pods. When you run several copies of the operator for availability, leader election ensures only one acts at a time, so two controllers never fight over the same objects.

Simple Analogy

Owner references work like name labels on lunch boxes in a school fridge. When a student leaves, the staff know exactly which boxes to clear. Leader election is like having one teacher on duty at a time, so two teachers do not give the class conflicting instructions.

i
Practical Tip

When something looks wrong, read the status of the collector resource before anything else. It is the operator’s own report on what it believes is true, and it often points straight at the problem.

4Installation, Prerequisites and Compatibility

Installing the operator is straightforward, but the surrounding choices decide how smooth your first month will be.

What You Need First

The operator needs a working Kubernetes cluster with permission to install custom resource definitions and cluster-wide roles. Most installations also need cert-manager, because of the webhook certificates described earlier. You should decide in advance which namespace will host the operator, which namespaces it will watch, and who in your organisation is allowed to create the custom resources it manages.

Ways to Install

Option 1

Helm Chart

The most common route. A community-maintained chart exposes settings for images, webhooks, certificates and feature gates, and fits well with existing release processes.

Option 2

Release Manifests

Applying the project’s published manifests gives a simple, transparent install that is easy to inspect and pin to a version.

Option 3

OperatorHub and OLM

On platforms that use the Operator Lifecycle Manager, the operator can be installed and upgraded through its catalogue.

Option 4

GitOps

Any of the above can be driven from a Git repository by a tool that applies and reconciles manifests, keeping installation reviewable and repeatable.

Versions and Compatibility

The operator is released frequently, and each release states which Kubernetes versions and which Collector versions it supports. The operator can also pick a default Collector image that matches its own version, which keeps managed collectors aligned with what the operator was tested against. Always read the release notes before upgrading, because custom resource schemas can change, and some features are controlled by feature gates that start disabled and later become the default.

1

Prepare the cluster

Confirm Kubernetes version support, install cert-manager if you plan to use it, and agree on namespaces and ownership.

2

Install the operator

Use your chosen method, pin an exact version, and confirm the controller and webhook Pods are healthy.

3

Create a first collector

Apply a small collector resource in a test namespace and check that the operator creates the expected objects.

4

Try auto-instrumentation

Create an Instrumentation resource, annotate one sample workload, and confirm that telemetry reaches the collector.

5

Harden and roll out

Add limits, security settings and monitoring, then introduce the operator to more namespaces gradually.

i
Practical Tip

Always try a new operator version in a non-production cluster first. Webhook behaviour changes can affect Pod creation across the whole cluster, so a quick rehearsal is far cheaper than a surprise in production.

5The OpenTelemetryCollector Resource in Depth

This is the most important resource in the operator, because it turns a short description into a running collector fleet.

What You Describe

A collector resource contains a handful of important fields. The mode says how the collector should run. The image says which Collector build to use. The configuration section holds the usual Collector pipeline description, with receivers, processors, exporters and the pipelines that connect them. Other fields cover the number of replicas, resource requests and limits, environment variables, volumes, scheduling rules and the service account to use.

Simple Analogy

The collector resource is like an order form for a custom meal. You tick the serving style, choose the ingredients and mention the portion size, and the kitchen takes care of cooking, plating and delivering it exactly as ordered.

What the Operator Builds From It

For each collector resource, the operator creates several Kubernetes objects. It generates a ConfigMap that holds the collector configuration, a workload object such as a Deployment, DaemonSet or StatefulSet, one or more Services so other Pods can reach the collector, and a service account if you did not provide one. If you enable features such as autoscaling or disruption budgets, it creates those objects too. All of these are owned by the collector resource, so deleting the resource cleans them up automatically.

Output 1

ConfigMap

Holds the rendered collector configuration. When you change the description, the operator updates it and rolls the Pods as needed.

Output 2

Workload

The Deployment, DaemonSet or StatefulSet that runs the collector containers in the mode you selected.

Output 3

Services

Stable network names for receivers such as OTLP, so applications can send data without knowing Pod addresses.

Output 4

Supporting Objects

Service accounts, autoscalers, disruption budgets and monitoring objects, created only when you ask for them.

The Value of Ports and Services Derived From Configuration

A nice feature is that the operator reads your collector configuration and works out which ports the receivers use, then exposes them automatically on the Service. This means you rarely need to maintain a separate list of ports. If you add a new receiver to the pipeline, the operator notices and updates the Service so traffic can reach it. This removes a common source of mismatch between configuration and networking.

!
Common Mistake

Editing the generated ConfigMap or workload directly. The operator treats the collector resource as the source of truth and will overwrite manual changes at the next reconciliation. Always change the collector resource, not the objects it produced.

A Tour of the Useful Fields

Beyond the mode, image and configuration, a collector resource exposes many Pod-level settings, which means you can tune a managed collector almost as finely as a hand-written workload. Knowing which fields exist saves you from editing generated objects, which the operator would overwrite.

Field group

Replicas and Autoscaling

Set a fixed replica count or let an autoscaler adjust it between a minimum and a maximum based on measured load.

Field group

Resources

Requests and limits for CPU and memory, which also guide scheduling and protect the node from runaway use.

Field group

Scheduling

Node selectors, tolerations and affinity rules to place collectors on suitable nodes and spread them across zones.

Field group

Security Settings

Pod and container security contexts, service accounts and image pull settings that match your cluster policies.

Field group

Environment and Volumes

Extra variables, mounted secrets and storage, used for credentials, certificates and persistent queues.

Field group

Labels and Annotations

Metadata added to Pods, helpful for cost allocation, monitoring discovery and policy tools.

Configuration Is Validated Early

The operator checks the structure of the collector configuration when the resource is created or changed. Some mistakes are caught immediately, for example a missing pipeline section or a wrong type. Other mistakes, such as naming a component that is not included in your chosen image, can only be discovered when the Collector starts. Use a test cluster and a small canary collector to catch these before they reach production.

Using Environment Values Inside the Configuration

The Collector configuration language lets you refer to environment variables, which is the correct way to keep secrets and per-environment values out of the written text. You declare the variable on the collector resource, supplied from a Secret or a plain value, and refer to it by name inside the configuration. The same description can then be reused across environments with only the variable values differing.

Simple Analogy

This is like a form letter with blanks for the recipient’s name and address. The letter stays the same for everyone, and each copy is filled in with its own details when it goes out.

i
Practical Tip

Keep one shared base description for your standard gateway and generate per-environment variants from it, changing only endpoints, credentials and sizes. It keeps differences small, visible and easy to review.

6Deployment Modes: Deployment, DaemonSet, StatefulSet and Sidecar

The mode is the single most important design choice you make for a collector, because it decides where the collector runs and what it is good at.

Mode One: Deployment

In deployment mode the operator creates a standard Kubernetes Deployment, which runs a chosen number of identical collector Pods anywhere in the cluster. This is the usual choice for a central gateway that many applications and agents send data to. It scales simply by changing the replica count or enabling autoscaling, and it suits tasks such as batching, filtering, sampling and exporting to backends.

Mode Two: DaemonSet

In daemonset mode the operator runs exactly one collector Pod on every node. This is the classic agent pattern. Applications send data to the collector on their own node, which keeps network hops short and makes it easy to collect node-level information such as host metrics and container logs. It is also the right mode when the collector needs access to files on the node.

Mode Three: StatefulSet

In statefulset mode each collector Pod gets a stable identity and can have its own persistent storage. This matters for components that need to remember something between restarts, such as a persistent queue, and for the Target Allocator pattern, where each collector replica is assigned a predictable share of Prometheus targets.

Mode Four: Sidecar

In sidecar mode the operator does not create a standalone workload at all. Instead it injects a collector container into the Pods of your application when they are created, triggered by an annotation. Each application Pod therefore gets its own private collector. This gives strong isolation and lets each team tune its own pipeline, at the price of more containers and more resource use.

ModeRuns AsBest ForWatch Out For
DeploymentReplicated central PodsGateways, sampling, central exportNeeds a load balancing plan for stateful processing
DaemonSetOne Pod per nodeNode agents, host metrics, log filesResource use grows with node count
StatefulSetPods with stable identity and storageTarget Allocator, persistent queuesSlower, more careful rollouts
SidecarExtra container in app PodsIsolation, per-application pipelinesOverhead repeated in every Pod
Simple Analogy

Think of mail collection. A deployment is a central post office that everyone sends letters to. A daemonset is a postbox on every street. A statefulset is a postbox with a named, numbered slot for each regular sender. A sidecar is a private mailbox attached to every single house.

i
Practical Tip

A very common and healthy design uses two layers. Run a daemonset agent on every node for local collection, then forward to a deployment gateway that handles heavy processing and exports to the backend. This combines short network paths with central control.

7Collector Configuration, Images and Distributions

Because the operator controls which Collector build runs and how it is configured, these choices affect security, size and available features.

Which Collector Image to Use

The OpenTelemetry project publishes several Collector builds. A core build contains a small set of well-supported components. A contrib build contains a very large collection of community components, such as many receivers, processors and exporters. A Kubernetes-focused build and vendor distributions also exist. The operator lets you set the image on each collector resource, and it provides a default if you do not.

Advantages of the Contrib Image

  • Almost every component you may need is already included
  • Fast to start with and easy to experiment on
  • Large community and many examples available

Disadvantages / Trade-offs

  • Large image size and larger attack surface
  • Includes components you will never use
  • Component stability levels vary, so check before depending on one

Building a Custom Distribution

Many organisations build their own slim distribution that contains only the components they actually use, using the OpenTelemetry Collector builder tool. The result is a smaller image with fewer dependencies to patch, and you can point your collector resources at it through the image field. This takes some upfront effort, but it pays back in security reviews and faster Pod startup.

Keeping Configuration Safe and Readable

Collector configuration can become long and complicated. Keep it readable by using clear names for each pipeline, adding comments explaining why unusual rules exist, and splitting very large setups into several collectors by purpose. Store the resources in Git and review changes the same way you review code. Secrets, such as backend tokens, should come from Kubernetes Secrets mounted or injected as environment variables, never written into the configuration text itself.

Simple Analogy

Choosing the contrib image is like buying a toolbox with five hundred tools when you need six. It is reassuring to have everything, but it is heavy, hard to organise, and gives more places for rust to hide.

!
Common Mistake

Pinning nothing. Using a floating image tag means a collector Pod that restarts tomorrow may behave differently from the one running today. Pin exact versions and upgrade deliberately, with a test, rather than by accident during a routine restart.

Understanding Collector Components in Plain Words

A Collector pipeline is made of four kinds of parts, and the operator simply passes your description of them to the Collector. Receivers are the doors through which data enters, for example one that speaks the OpenTelemetry protocol or one that scrapes Prometheus endpoints. Processors are the workers in the middle that change the data, such as batching it, adding Kubernetes details, filtering unwanted items or limiting memory. Exporters are the doors out, sending data to a backend. Connectors link one pipeline to another, for instance turning spans into metrics.

Part 1

Receivers

Accept telemetry from applications, agents or other collectors over network protocols or by scraping.

Part 2

Processors

Transform, enrich, filter, sample and protect data as it passes through the pipeline.

Part 3

Exporters

Send the finished data to storage and analysis tools, with queues and retries for reliability.

Part 4

Connectors

Join the end of one pipeline to the start of another, enabling steps like generating metrics from traces.

Enriching Data With Kubernetes Details

A very common processor adds Kubernetes information, such as the Pod name, namespace, node and workload labels, to every piece of data that passes through. It works by recognising the sender, usually from its network address or an identifier on the data, and looking up the matching Pod from the cluster. This needs read access to Pod information, which the operator can help you grant through a service account. The payoff is large, because telemetry that knows where it came from is far easier to search and group.

Simple Analogy

A Collector pipeline is like a factory conveyor belt. Receivers are the loading docks, processors are the stations that sort, label and inspect parcels, and exporters are the dispatch bays. The operator is the site manager who makes sure the belt is built to the plan and keeps running.

i
Practical Tip

Keep the order of processors deliberate. A sensible order puts the memory limiter first, then enrichment and filtering, and the batch processor near the end, so the collector protects itself before doing expensive work.

8Auto-Instrumentation: The Big Idea

Auto-instrumentation lets an application produce telemetry without its developers changing a single line of code.

Manual versus Automatic Instrumentation

Instrumentation means adding the code that records what an application is doing. Manual instrumentation means developers add that code themselves, choosing exactly what to record. Automatic instrumentation uses an agent that attaches to the running application and records common activity, such as incoming web requests, outgoing calls and database queries, based on knowledge of popular libraries. It gives broad coverage quickly, though it cannot know your business-specific events.

Simple Analogy

Manual instrumentation is like a shopkeeper writing a careful diary of every sale. Automatic instrumentation is like installing a door counter and a till receipt printer. You instantly get a good picture of visitors and sales, and you can still write personal notes in the diary where they matter.

What the Operator Adds

Normally, setting up an agent means rebuilding images, downloading the right agent version, passing the right startup options and setting a dozen environment variables, for every service and every language. The operator does all of this at Pod creation time. You define the settings once, in an Instrumentation resource, and mark which workloads should receive them. The operator then prepares each new Pod so the agent is in place when the application starts.

No code
Application source stays unchanged
No rebuild
Images stay unchanged
One place
Settings defined centrally

Why This Matters at Scale

In a company with hundreds of services, asking every team to learn and apply instrumentation setup is slow and uneven. With the operator, a platform team can offer instrumentation as a service. Teams opt in with one annotation, and the platform team controls versions, endpoints and sampling in a single place. When a new agent version is released, the platform team updates one resource and new Pods start using it, a vast improvement over chasing hundreds of repositories.

i
Practical Tip

Treat auto-instrumentation as a fast starting point, not an ending. Use it to get broad coverage on day one, then add manual spans and attributes for the business events that matter most to your teams.

How Auto-Instrumentation Compares With Other Approaches

The operator’s approach is one of several ways to get telemetry from an application. Each approach has strengths, and the best systems often combine them. The table compares the main options so you can see where agent injection through the operator fits.

ApproachCode ChangesDepth of DetailMain StrengthMain Limit
Manual SDK instrumentationYesVery deep and business-awareExactly the data you wantSlow to roll out across many services
Operator agent injectionNoGood for common librariesFast, uniform rolloutLimited by language and library support
eBPF-based observationNoNetwork and basic request levelWorks for compiled languagesNeeds privileges and gives less context
Service mesh telemetryNoNetwork edges between servicesUniform view of trafficCannot see inside a service

The Limits of Automatic Agents

An agent can only record what it understands. It will see an incoming web request and an outgoing database call, but it will not know that a request was a premium customer’s checkout or that a retry loop was triggered by a business rule. It also depends on the libraries your application uses being supported. For unusual frameworks or custom protocols, you may see gaps in traces, such as a call that appears out of nowhere or a missing link between two services.

Gap Example: Message Queues

If a producer and consumer use a library that the agent does not recognise, the trace may stop at the queue. Adding manual propagation code at those two points restores the link.

Gap Example: Background Jobs

Scheduled jobs often start without any incoming request, so there is no parent trace. Manual spans around the job give it a clear starting point.

Simple Analogy

An automatic agent is like a security camera in a shop. It records everyone who walks in and out, but it cannot tell you why someone put an item back. For that kind of knowledge, you need a shop assistant who writes notes, which is what manual instrumentation provides.

9How Injection Works Step by Step

The injection flow is the heart of the operator’s most visible feature, so it is worth following one Pod through the whole journey.

The Journey of One Pod

The journey starts when a Deployment, or another controller, asks the cluster to create a new Pod. Before the Pod is stored, the API server calls the operator’s mutating webhook. The webhook checks the Pod’s annotations to see whether instrumentation is requested for a specific language. If it is, the webhook finds the matching Instrumentation resource, then modifies the Pod description before it is saved.

sequenceDiagram
  participant D as Deployment controller
  participant A as API server
  participant W as Operator webhook
  participant K as Kubelet
  D->>A: Create Pod
  A->>W: Ask to mutate Pod
  W->>W: Read annotation and find Instrumentation
  W-->>A: Return Pod with init container, volume and env vars
  A->>K: Schedule modified Pod
  K->>K: Run init container to copy agent
  K->>K: Start application with agent loaded
        
FIG 2 — The life of a Pod that receives auto-instrumentation
1

The annotation is detected

The webhook sees an annotation on the Pod or its namespace asking for instrumentation in a certain language.

2

An init container is added

A small container is added to run before the application. Its only job is to copy the agent files into a shared volume.

3

A shared volume connects the pieces

An empty volume is mounted into both the init container and the application container, so the agent files copied in the first step are visible to the second.

4

Environment variables are set

The operator adds variables that tell the agent how to start and where to send data, including the service name and exporter endpoint.

5

The application starts with the agent

When the application container starts, its runtime loads the agent from the shared volume and begins recording telemetry.

Why Only New Pods Are Affected

The webhook acts at Pod creation. Existing Pods are never touched, because Kubernetes does not let you reshape a running Pod in this way. After you add an annotation to a Deployment, its Pods must be recreated, usually by a rolling restart, before injection happens. This is also why a change to the Instrumentation resource only reaches Pods created afterwards.

Simple Analogy

Think of a school uniform handed out on the first day. Students already in class do not get new uniforms halfway through the year, and only the new arrivals walk in wearing the updated style.

!
Common Mistake

Adding the annotation to the Deployment’s own metadata instead of to its Pod template. The webhook inspects the Pod, so the annotation must appear on the Pod template. Annotations placed in the wrong spot are silently ignored, and nothing is injected.

10Supported Languages and Annotations

Different runtimes load agents in different ways, so the operator treats each language separately and asks you to name the language you want.

The Language Families

Runtime

Java

Uses a Java agent attached at startup, which instruments many popular frameworks automatically. One of the most mature options.

Runtime

Node.js

Loads instrumentation packages when the application starts, covering common web and database libraries.

Runtime

Python

Adds instrumentation through a startup hook that patches popular libraries at runtime.

Runtime

.NET

Uses a profiler-based approach that requires choosing the right variant for the base operating system image, such as glibc or musl.

Runtime

Go

Uses an eBPF-based approach, because Go programs are compiled and cannot be patched like interpreted ones. It needs elevated privileges and extra care.

Runtime

Apache HTTPD and Nginx

Web servers can be instrumented through modules loaded into the server, giving visibility at the edge of your system.

The Annotation Pattern

The workload carries an annotation whose name includes the language, for example one meaning “inject Java instrumentation.” The value says which Instrumentation resource to use. A simple “true” means use the one in the same namespace. A name selects a specific resource, and a namespace-and-name pair can point to one in another namespace. Putting the annotation on a namespace instead of a workload applies it to every Pod created there, which is convenient but broad.

Multiple Containers and Languages

Some Pods have several containers, and they may even use different languages. The operator supports selecting which containers to instrument, so that sidecars, proxies and helper containers are left alone. This is important because injecting an agent into the wrong container wastes resources and can cause confusing failures.

ScopeWhere the Annotation GoesEffect
One workloadPod template of the Deployment or StatefulSetOnly its new Pods are instrumented
One namespaceNamespace metadataAll new Pods in the namespace are instrumented
Selected containersPod annotation naming containersOnly the named containers receive the agent
i
Practical Tip

Start with workload-level annotations during rollout, so only the services you chose are affected. Move to namespace-level annotation only when you are confident that every workload there is a good candidate.

Practical Notes for Each Runtime

Each language brings its own small surprises, and knowing them in advance saves hours of confusion. Java agents add some startup time and memory, so watch container limits after enabling them. Node.js and Python rely on startup hooks, so applications that launch through unusual wrapper scripts may bypass the hook, and the agent never loads. For .NET, the base image matters, because the agent must match the operating system library family inside the container. Go instrumentation relies on observing the running program from outside, so it needs privileges that other languages do not.

Check Container Memory After Enabling Agents

Agents use extra memory for buffers and class data. A container that ran comfortably near its limit before may be killed afterwards, so raise limits modestly and measure.

Check How the Application Starts

If the container starts through a shell script that launches the program indirectly, confirm that the environment variables set by the operator are passed along to the real process.

Match the Base Image

Small Alpine-style images use a different system library from common Debian-style ones, and some agents ship separate builds for each. Choosing the wrong one produces startup failures that look unrelated.

11Configuring the Instrumentation Resource

The Instrumentation resource is where the platform team decides how every instrumented application should behave.

The Main Settings

Setting

Exporter Endpoint

Where the agent sends data, usually the address of a collector Service inside the cluster.

Setting

Propagators

The formats used to pass trace context between services, such as W3C Trace Context and baggage. All services must agree.

Setting

Sampler

The rule for deciding which traces to keep, for example a fixed percentage chosen at the start of each trace.

Setting

Resource Attributes

Descriptive facts attached to all telemetry, such as environment and team, plus automatically derived Kubernetes details.

Setting

Agent Images

The container images that carry the agent for each language, which control exactly which agent version is injected.

Setting

Environment Overrides

Extra variables for each language, useful for tuning agent behaviour without rebuilding anything.

Kubernetes Details Added for Free

One of the nicest features is that the operator fills in useful resource attributes from the Pod itself, such as the Pod name, namespace, node and workload name. It does this by passing information into the container through standard Kubernetes mechanisms. These attributes make telemetry far more useful, since you can instantly filter traces and metrics by namespace or workload without asking developers to add anything.

Simple Analogy

The Instrumentation resource is like the uniform policy of a company. It states the colours, the badge style and where to hand in reports. Every employee, no matter which department, follows the same policy without needing to read it each morning.

Sampling Choices in Practice

Sampling at the agent is the cheapest place to reduce volume, because dropped data never leaves the process. A parent-based sampler is common, where each new trace is sampled at a fixed ratio, and downstream services follow the decision they receive. This keeps traces complete across services. For smarter decisions, such as always keeping errors, teams often combine agent-level head sampling with tail sampling in a collector.

!
Common Mistake

Letting different services use different propagators. If one service writes a format that the next cannot read, traces break into disconnected fragments. Set propagators centrally in the Instrumentation resource, and keep them identical across the whole system.

How Service Names and Attributes Are Chosen

Every telemetry stream needs a service name, otherwise your tools show a pile of unnamed data. In many setups the operator derives the service name from the workload, using the name of the Deployment or a standard Kubernetes label. Recent versions can also use well-known labels, such as the application name and version labels, to fill in the service name and version. Whichever source you rely on, agree on one convention across the company and document it, because a consistent naming scheme is what makes dashboards and alerts reusable.

One Resource or Many

You can define several Instrumentation resources in different namespaces, each with its own endpoint, sampler or image set. This is useful when environments differ, for example a development namespace that samples everything and a production namespace that samples a small fraction. A workload can name a specific resource in its annotation, so teams with special needs can opt into a tuned setting without affecting others.

1

Decide your naming convention

Choose where service names and versions come from and write the rule down so every team follows it.

2

Create a baseline resource

Define one default Instrumentation resource per environment with the shared endpoint, propagators and a conservative sampler.

3

Add variants only when needed

Create extra resources for teams that need different sampling or images, and review each one for a clear reason.

Agent Versions and Rollouts

Because agent images are defined in the Instrumentation resource, upgrading an agent is a one-line change that affects only newly created Pods. This gives a natural gradual rollout, since Pods pick up the new version as they restart through normal deployments. If a new agent version misbehaves, reverting the resource change and restarting affected workloads returns them to the previous version.

Simple Analogy

Updating the agent image is like changing the standard recipe in a restaurant’s kitchen manual. Dishes already served stay as they were, and every new dish follows the new recipe from that moment on.

!
Common Mistake

Upgrading the agent image for every service at once. A faulty agent can then affect the whole fleet at the next round of restarts. Stage agent upgrades, starting with a few low-risk services, and watch their error rates and latency before widening the rollout.

12The Target Allocator and Prometheus Metrics

When you scrape Prometheus metrics with several collector replicas, something has to make sure each target is scraped by exactly one of them.

The Problem It Solves

Many Kubernetes applications expose metrics in the Prometheus format, and the Collector can scrape them with a Prometheus receiver. If you run a single collector, it scrapes everything, which becomes a bottleneck as the cluster grows. If you run several replicas with the same configuration, each one finds the same targets and scrapes all of them, so the data is duplicated and the load is multiplied instead of shared.

What the Target Allocator Does

The Target Allocator is a separate component, managed by the operator, that discovers scrape targets and divides them fairly among the collector replicas. Each replica asks the allocator which targets it should scrape, and the allocator answers with a distinct share. When Pods appear or disappear, the allocator updates the shares, so scraping rebalances automatically. It also understands the ServiceMonitor and PodMonitor resources that many teams already use with the Prometheus Operator, which makes migration easier.

Simple Analogy

Imagine ten delivery drivers and a thousand parcels. If every driver receives the full list, they all deliver the same parcels and waste fuel. A dispatcher who gives each driver a separate bundle ensures every parcel is delivered once. The Target Allocator is that dispatcher.

flowchart LR
  SM["ServiceMonitor and PodMonitor resources"] --> TA["Target Allocator"]
  K8["Kubernetes service discovery"] --> TA
  TA --> C1["Collector replica 1"]
  TA --> C2["Collector replica 2"]
  TA --> C3["Collector replica 3"]
  C1 --> B["Backend"]
  C2 --> B
  C3 --> B
        
FIG 3 — The Target Allocator shares scrape targets across collector replicas

Allocation Strategies

The allocator can use different strategies to share targets. A simple strategy gives each replica the least-loaded share at each moment. Another strategy keeps targets attached to the same replica as long as possible, which reduces gaps and duplicates when the set of replicas changes. A third strategy groups targets by node, which pairs well with the daemonset mode, so each node-level collector scrapes only its own node. Pick the strategy that matches your mode and your tolerance for movement.

Advantages

  • No duplicate scraping across replicas
  • Scales scraping horizontally as the cluster grows
  • Reuses existing ServiceMonitor and PodMonitor resources
  • Automatically rebalances when Pods come and go

Disadvantages / Trade-offs

  • One more component to run, secure and monitor
  • Needs permission to discover targets across the cluster
  • Rebalancing can briefly cause gaps or duplicate samples

When Not to Use the Target Allocator

The allocator is valuable when several collector replicas must share a large number of scrape targets. If your cluster is small and a single collector can scrape everything comfortably, the extra component adds operational work without a clear benefit. Likewise, if your applications push metrics using the OpenTelemetry protocol instead of exposing Prometheus endpoints, there is nothing to scrape and no allocation needed. Choose it because a real scaling or duplication problem exists, not because it sounds more advanced.

13Common Architecture Patterns

The pieces described so far can be combined in several well-known ways, each with its own strengths.

Pattern One: Agent Only

Every node runs a daemonset collector that receives data from local applications and exports directly to the backend. It is simple and fast to set up, and works well for small to medium clusters. The downside is that every node-level collector needs backend credentials, and global decisions such as tail sampling are hard to make, because no single collector sees an entire trace.

Pattern Two: Agent and Gateway

Node-level collectors forward data to a central pool of deployment-mode collectors, which perform heavier work and export to the backend. This is the most common production pattern. It keeps credentials in one place, allows central policies such as filtering and sampling, and gives you a single point to protect from overload.

Pattern Three: Sidecar per Application

Each application Pod receives its own collector container. This gives strong isolation, so one team’s heavy pipeline cannot disturb another’s, and allows per-application customisation. The cost is higher resource use and more containers to manage, so it is best reserved for workloads that truly need it.

flowchart LR
  A1["App Pods"] --> D1["Node agent collectors: DaemonSet"]
  A2["Apps with auto-instrumentation"] --> D1
  D1 --> G["Gateway collectors: Deployment"]
  G --> T["Tail sampling and filtering"]
  T --> X["Backends"]
        
FIG 4 — The popular agent plus gateway layout

Choosing Between Them

PatternComplexityCentral ControlIsolationResource Cost
Agent onlyLowWeakLowLow
Agent and gatewayMediumStrongMediumMedium
Sidecar per applicationMedium to highWeakHighHigh
Simple Analogy

Agent only is like each shop sending its own parcels to the courier. Agent and gateway is like shops handing parcels to a local depot that sorts them before shipping. Sidecar is like every shop owning a private delivery van. Each works, but the costs and controls differ.

i
Practical Tip

If you are unsure, start with agent and gateway. It is the best balance of simplicity and control, and you can move individual workloads to sidecars later if a special need appears.

14Scaling and High Availability

A telemetry pipeline that falls over during a traffic surge fails exactly when you need it most, so scale and resilience deserve early attention.

Scaling the Gateway

For deployment-mode collectors the operator can create a Horizontal Pod Autoscaler, which adds or removes replicas based on measurements such as CPU or memory use. Set sensible minimum and maximum replica counts, and choose resource requests that match real usage. A gateway that is slightly over-provisioned is far cheaper than one that drops data during a sale or an incident.

Protecting Against Overload

Pair scaling with protective settings inside the collector. A memory limiter processor prevents a sudden flood from crashing the process, and a batch processor makes exports efficient. Sending queues and retries inside exporters smooth over short backend outages. The goal is for the system to bend under pressure and recover, rather than to break and lose everything.

Keeping Collectors Available During Changes

A Pod disruption budget limits how many collector Pods can be taken down at once during node maintenance or upgrades. Spreading replicas across nodes and zones with scheduling rules protects against the loss of a single machine or data centre. For the Target Allocator pattern, check how scrape ownership moves when replicas restart, so you understand any short gaps.

Stateless Gateway Scaling

Plain batching and exporting are stateless, so replicas can be added freely behind a load-balanced Service. Autoscaling works smoothly here.

Stateful Processing Needs Routing

Tail sampling and some metric conversions need all data for a trace or series to reach the same replica. A two-layer design with a load-balancing exporter in front handles this correctly.

Node-Level Agents Scale Automatically

A daemonset grows with the node count by design. Watch total resource use, since small per-node costs add up in large clusters.

Simple Analogy

Scaling a gateway is like opening more checkout counters when a queue forms. A memory limiter is like the rope barrier that stops too many people entering at once, and a disruption budget is the rule that never lets all counters close together for lunch.

!
Common Mistake

Autoscaling a stateful processing tier as if it were stateless. Adding replicas redistributes data, which can break tail sampling decisions and conversions. Design routing first, and only then enable autoscaling.

Capacity Planning With a Simple Example

Good sizing starts from measurement. Suppose your applications together send fifty thousand spans per second at peak, and the average span, once encoded, is about one kilobyte. That is roughly fifty megabytes per second of incoming data, so a gateway tier must comfortably handle that rate with headroom. If one collector replica can sustainably process ten thousand spans per second with its configured processors, you would plan for at least five replicas, and in practice seven or eight to survive the loss of a node and absorb bursts.

This kind of arithmetic is only a starting point, because real capacity depends on which processors you run. Tail sampling holds traces in memory while waiting, so it needs much more memory than simple batching. Always confirm with a load test that mimics real traffic, and revisit the numbers whenever traffic or processing rules change.

Backpressure and Queues

When a backend slows down, a collector has to decide what to do with data it cannot send yet. A sending queue holds it for a while, and retries try again after short delays. Queues are held in memory by default, which is fast but lost on restart. A persistent queue writes data to disk, which survives restarts but needs storage and careful sizing. In the operator, a statefulset collector with a volume is the natural home for persistent queues.

Advantages of Persistent Queues

  • Data survives collector restarts and short backend outages
  • Smooths over bursts without immediate loss
  • Gives operators time to fix a failing backend

Disadvantages / Trade-offs

  • Needs storage, which must be sized and monitored
  • Statefulset rollouts are slower and more careful
  • A very long outage can still fill the disk
Simple Analogy

A queue is like a waiting room at a clinic. A small room clears out when the clinic closes unexpectedly, whereas a larger, sturdy one keeps patients safe until the doctor returns. Either way, the room has a limit, and when it is full somebody must be turned away.

i
Practical Tip

Decide in advance what should be dropped first when the system is under pressure. Debug-level logs and low-value metrics can be discarded sooner than error traces and key service metrics, which are worth protecting.

15Security, RBAC and Multi-Tenancy

An operator holds broad powers inside the cluster, so its security needs the same attention as any other privileged component.

Permissions of the Operator Itself

To do its work, the operator needs permission to create and update Deployments, DaemonSets, StatefulSets, ConfigMaps, Services and more, and to watch the custom resources it manages. It also controls webhooks that touch Pod creation across the cluster. Treat its service account, its image and its namespace as sensitive, restrict who can change its configuration, and keep it patched.

Who May Create Custom Resources

Anyone who can create an OpenTelemetryCollector resource can cause Pods to run in your cluster, and anyone who can create an Instrumentation resource can influence which images are injected into other Pods. Use standard Kubernetes role-based access control so only trusted platform engineers can create these resources, or limit teams to their own namespaces. Without this, a well-meaning user could accidentally cause a large rollout, and a bad actor could inject unwanted code.

Simple Analogy

The operator is like a building manager with a master key. A master key is very convenient, but you would only hand it to someone trusted, and you would keep a clear record of who is allowed to give that manager instructions.

Securing the Telemetry Itself

Control

Encrypted Transport

Use TLS between applications, collectors and backends so telemetry cannot be read or altered on the network.

Control

Authentication

Require tokens or certificates on collector receivers that are reachable beyond a single trusted namespace.

Control

Secret Handling

Supply backend credentials through Kubernetes Secrets and never place them in readable configuration text.

Control

Data Scrubbing

Remove or mask sensitive attributes, such as personal data or tokens, in collector processors before export.

Special Care for Privileged Instrumentation

Most language agents run entirely inside the application container with no special rights. The Go approach, however, relies on eBPF, which needs elevated privileges and access to parts of the node. Because this widens the attack surface, use it only for workloads that need it, run it in tightly controlled namespaces, and follow your security team’s policies for privileged containers.

Advantages of Namespaced Ownership

  • Teams manage their own instrumentation settings
  • Mistakes affect only one namespace
  • Clear accountability for cost and behaviour

Disadvantages / Trade-offs

  • Settings can drift between teams without shared standards
  • More resources to review and keep consistent
  • Central security checks must cover many namespaces
!
Common Mistake

Exposing a collector receiver to the whole cluster, or beyond, with no authentication. Anyone who can reach it can send fake telemetry or flood it. Limit exposure with network policies and require authentication whenever a receiver is reachable from untrusted sources.

16Monitoring the Operator and Its Collectors

A system that watches everything else must be watched itself, otherwise a silent failure will leave you blind without warning.

What to Watch on the Operator

The operator exposes its own health information, including whether its Pods are running, how often its reconciliation loops succeed or fail, and how long they take. Repeated reconciliation errors usually mean a custom resource is invalid or a permission is missing. Also watch webhook call duration and failures, since slow webhooks delay Pod creation across the cluster.

What to Watch on Managed Collectors

Collectors publish internal metrics about the data they receive, process and export. Useful signals include the number of data points accepted and refused, the number sent successfully and the number that failed to send. Queue size and memory use show when a collector is nearing overload, and restart counts show instability. Send these self-metrics to a place that is independent of the collector fleet being watched.

Received
Data entering the collector
Refused
Data rejected under pressure
Send failed
Data that could not leave

Alerts Worth Setting

1

Operator not ready

Alert if the operator Pods are unavailable for more than a short period, because new injections and updates will stop.

2

Reconciliation failing

Alert when reconciliation errors persist, as they indicate that some resource is not reaching its desired state.

3

Collector export failures

Alert on sustained send failures or refused data, which means telemetry is being lost.

4

No data from a service

Alert when an expected service suddenly stops sending data, which can reveal a broken injection or network change.

Simple Analogy

Monitoring the pipeline is like checking that the smoke detectors themselves have working batteries. A detector with a dead battery looks fine on the ceiling, yet gives you no protection when you need it.

i
Practical Tip

Keep a small, separate “watchdog” path for the collectors’ own health data, ideally to a different backend or tenant. If the main pipeline fails, you still need a way to find out why.

Building Useful Dashboards

A good operations dashboard for this system answers four questions at a glance. Is the operator healthy? Are all expected collectors running and ready? Is data flowing in and out at normal rates? Is anything being refused or failing to send? Put these four panels at the top, and add detail below for memory use, queue size, restarts and the latency of exports. Keep the dashboard simple enough that an on-call engineer can read it in thirty seconds.

Panel 1

Operator Health

Shows ready Pods, reconciliation success rate and webhook latency in one place.

Panel 2

Collector Readiness

Shows desired versus ready replicas for each collector resource, plus recent restarts.

Panel 3

Data Flow

Shows received and exported counts per signal, so a sudden drop stands out clearly.

Panel 4

Pressure and Loss

Shows refused points, failed sends and queue fill levels, the early signs of overload.

Using Logs and Events

The operator writes logs that describe what it decided to do and why, and Kubernetes events record notable moments, such as an object being created or a webhook failing. Collect these like any other workload’s logs. When you investigate an incident later, the sequence of events in the operator’s logs often reconstructs the story precisely, including the exact moment a resource was changed.

Simple Analogy

A good dashboard is like a car’s dashboard. It does not show every detail of the engine, only the few lights that tell you whether you can keep driving, with a way to open the bonnet when a light turns red.

17Upgrades, Lifecycle and GitOps

The operator makes upgrades easier, but only if you treat upgrades as a planned process rather than a surprise.

Two Things Get Upgraded

There are two separate upgrade tracks. The first is the operator itself, which brings new features, new custom resource versions and changed defaults. The second is each managed collector and each injected agent, which have their own versions. The operator can help by moving managed collector instances toward a version it was tested with, depending on your settings, but you remain responsible for deciding when and how.

Upgrade Order and Safety

Read the release notes first. Upgrade custom resource definitions carefully, because the cluster needs to understand any new schema before resources use it. Upgrade the operator in a test cluster, confirm that existing collectors and instrumentation still behave, then roll out to production in stages. Keep the previous version’s manifests available so you can roll back quickly if something unexpected appears.

Simple Analogy

Upgrading the operator is like changing the manager of a hotel. You would first check that the new manager understands the existing rules, meet them on a quiet day, and keep the old manager’s handover notes in case you need them.

GitOps Makes It Reviewable

Because everything the operator manages is described in plain resources, you can store them in Git and let a GitOps tool apply them. Every change then has an author, a reason, a review and a history. Rolling back becomes reverting a commit. This pairs naturally with the operator model, since both rely on the same idea: describe the desired state clearly, and let automation make it real.

DECISION-01 Recommended
Context

Many teams share a cluster, and telemetry configuration changes often. Manual edits cause drift and unexplained behaviour.

Decision

Keep all collector and instrumentation resources in Git, apply them through a GitOps tool, and block direct edits in the cluster for these resource types.

Consequence

Changes are reviewed, repeatable and easy to revert. The trade-off is a slightly slower path for emergency fixes, which is handled with a documented fast-track review.

!
Common Mistake

Upgrading the operator and the Collector image on the same day without testing. If something breaks you will not know which change caused it. Change one thing at a time, and observe before moving to the next.

18Troubleshooting Common Problems

Most problems with the operator fall into a few well-known patterns, and knowing them turns a long investigation into a short checklist.

Problem: Injection Does Not Happen

The Pod starts without an agent. The usual causes are an annotation placed in the wrong spot, a language name that does not match, an Instrumentation resource that does not exist in the expected namespace, or a Pod that was created before the annotation was added. Check the Pod’s final description to see whether an init container and environment variables are present, and look at the operator logs for webhook messages.

Problem: The Webhook Blocks or Delays Pods

New Pods hang or are rejected. Typical causes are an unavailable operator, expired or untrusted certificates, or network rules that stop the API server from reaching the webhook port. Check certificate validity, confirm that the webhook Service has healthy endpoints, and review the webhook’s failure policy to understand what happens when it is unreachable.

Problem: Collector Pods Crash or Restart

Look at the collector logs first. Configuration errors, such as a misspelled component name or a component missing from the chosen image, are common. Memory kills point to missing limits or missing memory limiter settings. If you use a slim custom image, confirm that every component named in the configuration is actually compiled into it.

Problem: Data Reaches the Collector but Not the Backend

Check the collector’s own metrics for failed sends, then verify credentials, endpoints and network policies. Look for refused data caused by memory pressure. Confirm that the pipeline definition connects the receiver to the exporter, since a component that is defined but not used in any pipeline does nothing.

SymptomLikely CauseFirst Check
No agent in the PodAnnotation wrong or Pod not recreatedInspect the running Pod for an init container
Pods stuck while creatingWebhook unreachable or certificate problemCheck webhook Service endpoints and certificates
Collector restarts repeatedlyBad configuration or memory limitRead collector logs and memory settings
Missing tracesWrong endpoint, propagators or samplingCheck exporter endpoint and sampler setting
Duplicate metricsSeveral replicas scraping the same targetsConfirm the Target Allocator is enabled
Simple Analogy

Troubleshooting the operator is like finding why a lamp will not light. Check the plug, then the switch, then the bulb, in that order, instead of rewiring the house. Most failures turn out to be the plug.

i
Practical Tip

Always begin with the Kubernetes events and the operator logs. They usually state the problem plainly, and reading them first prevents guesswork.

A Calm Debugging Routine

When something is wrong, resist the urge to change things at random. Follow a fixed routine, which narrows the problem quickly and leaves a clear record of what you tried.

1

State the symptom precisely

Write down exactly what is missing or broken, for which service, since when, and what changed around that time.

2

Find the first broken link

Follow the data path in order: application, agent, collector receiver, processors, exporter, backend. The first broken link is your target.

3

Read events, status and logs

Check the resource status, Kubernetes events and the logs of the component at that link before making changes.

4

Change one thing and observe

Make a single small change, wait for it to take effect, and check whether the symptom moves. Record the result either way.

5

Capture the lesson

Add the cause and the fix to a runbook, and consider an alert that would have caught it sooner.

Temporary Debug Tools

A debug exporter that prints received data to the collector’s own logs is a handy way to see exactly what arrives and what leaves. Turn it on for a short time in a test collector, and never leave it enabled in a busy production pipeline, because printing every record is costly and may expose sensitive data in logs.

!
Common Mistake

Debugging on the busiest production collector. A temporary exporter or extra logging there adds load and can hide the real problem behind new noise. Reproduce the issue in a small, separate collector whenever possible.

19Anti-Patterns to Avoid

Naming common mistakes makes them easier to spot in reviews and design discussions.

ANTI-PATTERN-01 Avoid
Problem

Every namespace is annotated for instrumentation by default, including system namespaces and helper workloads.

Why It’s Harmful

Agents are injected into containers that do not need them, adding startup time, memory use and unexpected failures, and raising telemetry volume without value.

Correct Approach

Opt in per workload or per carefully chosen namespace, select specific containers, and exclude system components.

ANTI-PATTERN-02 Avoid
Problem

A single huge collector resource with a very long configuration handles every signal for every team.

Why It’s Harmful

A single mistake affects everyone, changes need wide agreement, and the configuration becomes impossible to understand or test.

Correct Approach

Split collectors by purpose, such as node agents, gateways and a dedicated metrics scraper, and keep each configuration small and focused.

ANTI-PATTERN-03 Avoid
Problem

Collectors run with no resource requests, no limits and no memory limiter.

Why It’s Harmful

A traffic spike can exhaust node memory, restart the collector, and take other workloads down with it.

Correct Approach

Set requests and limits, add a memory limiter processor, and size replicas using measured traffic rather than guesses.

ANTI-PATTERN-04 Avoid
Problem

Teams edit generated objects, such as the collector ConfigMap, directly in the cluster to fix urgent issues.

Why It’s Harmful

The operator overwrites these edits, so fixes vanish unexpectedly, and the real configuration drifts away from what the repository says.

Correct Approach

Change the collector resource itself, ideally through Git, and use a fast-track review for emergencies.

ANTI-PATTERN-05 Avoid
Problem

Floating tags are used for the operator, collector and agent images.

Why It’s Harmful

Any restart can silently introduce a new version, producing unexplained changes in behaviour that are hard to trace to a cause.

Correct Approach

Pin exact versions, test upgrades in a safe environment first, and roll out in stages with clear rollback steps.

20Real-World Scenarios and Trade-offs

Seeing the operator in a few realistic situations makes the earlier ideas concrete, and shows where it helps and where it adds burden.

Scenario: A Platform Team Offering Telemetry as a Service

A platform group runs a daemonset agent layer and a gateway layer, publishes one Instrumentation resource per environment, and tells product teams to add a single annotation to opt in. Teams get traces and metrics within a day, and the platform group can change endpoints and sampling for everyone in one commit.

Scenario: Migrating From a Prometheus-Only Setup

A company already uses ServiceMonitor and PodMonitor resources. They deploy a statefulset collector with the Target Allocator, reuse their existing monitors, and gradually add tracing alongside metrics, without rewriting any scrape configuration.

Scenario: A Legacy Java Fleet

Dozens of older Java services cannot easily be rebuilt. The operator injects the Java agent at Pod creation, giving them traces and metrics with no code change. Teams then add manual spans only to the few services where business events matter.

Scenario: A Small Team With One Application

A tiny team runs a single service and a single collector. The operator adds webhooks, certificates and custom resources that they may not need. A plain Deployment and configuration file can be a simpler and perfectly adequate choice.

Advantages

  • Declarative and consistent collector management
  • Code-free instrumentation across many languages
  • Central control of endpoints, sampling and versions
  • Prometheus target distribution with the Target Allocator
  • Fits naturally with GitOps and review workflows

Disadvantages / Trade-offs

  • Another privileged component to secure and operate
  • Webhooks sit in the Pod creation path
  • Auto-instrumentation coverage varies by language
  • Requires cert-manager or equivalent certificate handling
  • May be more than a very small setup needs
“The operator does not replace understanding your telemetry pipeline; it makes a well-understood pipeline repeatable.”

A Gentle Adoption Path

Teams that succeed with the operator rarely adopt everything at once. They climb in small steps, gaining value and confidence at each one before taking the next. This path keeps risk low and lets everyone learn the pieces in a sensible order.

1

Run one gateway collector

Use the operator to create a single deployment-mode collector, send a sample application’s data to it, and confirm export to the backend.

2

Add node agents

Introduce a daemonset collector for node-level data and logs, forwarding to the gateway.

3

Try auto-instrumentation on a few services

Create an Instrumentation resource and opt in a handful of low-risk workloads, comparing resource use before and after.

4

Bring Prometheus metrics in

Add a statefulset collector with the Target Allocator and reuse existing monitor resources.

5

Harden and standardise

Add limits, autoscaling, security rules, monitoring and a GitOps workflow, and publish shared defaults for every team.

Measuring Success

Decide how you will know the operator is helping. Useful measures include the time it takes a new service to start producing useful telemetry, the share of services with consistent naming and sampling, the number of incidents caused by telemetry configuration mistakes, and the effort the platform team spends on collector upkeep. If these improve over a few months, the operator is earning its place.

Simple Analogy

Adopting the operator is like learning to drive in stages. You first practise in an empty car park, then on quiet roads, and only later on the motorway. Each stage builds the skills needed for the next, and no one expects you to start at full speed.

21Frequently Asked Questions

Short, direct answers to the questions beginners and experienced engineers ask most often.

Q1Do I have to use the operator to run OpenTelemetry on Kubernetes?

No. You can run collectors with ordinary Deployments or Helm charts and instrument applications by hand. The operator is a convenience that adds declarative management, code-free instrumentation and Target Allocator support. It pays off most when many teams or services share one cluster and consistency matters.

Q2Is the operator the same as the Collector?

No. The Collector is the program that receives, processes and exports telemetry. The operator is a separate program that runs in the cluster and creates and manages Collectors, along with other things such as instrumentation injection. One manages the other.

Q3Why does the operator need cert-manager?

The Kubernetes API server only calls webhooks over secure connections, so the operator’s webhook needs a valid certificate. Cert-manager is the common way to create and renew it automatically. The operator can also generate certificates itself in some setups, but then you manage rotation and trust more manually.

Q4Why did my existing Pods not get instrumented after I added the annotation?

Injection happens when a Pod is created, not while it is running. After adding the annotation to the Pod template, restart the workload so new Pods are created. Also confirm the annotation is on the Pod template, not on the Deployment’s own metadata.

Q5Which deployment mode should I choose?

For a central gateway, use deployment mode. For node-level collection and logs, use daemonset mode. For Prometheus scraping with the Target Allocator, use statefulset mode. For strong isolation per application, use sidecar mode. Many teams combine a daemonset agent layer with a deployment gateway.

Q6Can the operator instrument every language?

It supports several important ones, including Java, Node.js, Python and .NET, plus Go through an eBPF-based approach and web servers such as Apache HTTPD and Nginx. Coverage and maturity differ between languages, so check the current documentation for what is supported and what limits apply to your runtime.

Q7What does the Target Allocator do?

It discovers Prometheus scrape targets and divides them among collector replicas so each target is scraped by exactly one replica. It also reads ServiceMonitor and PodMonitor resources, which helps teams reuse their existing Prometheus configuration.

Q8Will auto-instrumentation slow my application?

Agents add some overhead, because they record and export telemetry and add small steps to startup. The size depends on the language, the agent and your sampling settings. Measure on a test environment, use sampling to control volume, and instrument only the containers that need it.

Q9What happens if the operator goes down?

Existing collectors and already-injected Pods keep working, because they run independently. What stops is reconciliation and new injection. If the webhook is configured to fail closed for the Pods it covers, new Pod creation may be affected, so plan the operator’s availability and webhook failure behaviour deliberately.

Q10How should I keep configuration safe and reviewable?

Store collector and instrumentation resources in Git, apply them through a GitOps tool, pin image versions, and supply credentials through Kubernetes Secrets. Review every change like code, and test upgrades in a non-production cluster before rolling them out.

Q11Can the operator manage collectors in several namespaces?

Yes. By default it can watch the whole cluster, or you can limit it to chosen namespaces. Each namespace can have its own collector and Instrumentation resources, which supports team ownership. Decide early whether you want a single shared operator or a more restricted setup, since this affects permissions and how you structure ownership across teams.

Q12What is the difference between a sidecar collector and a daemonset collector?

A sidecar collector runs inside each application Pod as an extra container, so every application has its own private collector. A daemonset collector runs once per node and serves all Pods on that node. Sidecars give isolation and per-application tuning at a higher resource cost, while daemonsets are lighter and better for node-level data.

Q13How do I keep telemetry from different teams separate?

Use separate namespaces with separate collector resources, add team identifiers as resource attributes, and apply role-based access control so teams manage only their own resources. At the backend, many platforms support separate tenants or projects, and collectors can route each team’s data to the right one.

Q14Does the operator support logs, or only traces and metrics?

The Collector handles logs as well, and the operator manages the collectors that process them, commonly with a daemonset that reads container log files on each node. Auto-instrumentation agents focus mainly on traces and metrics, so log collection usually comes from the node-level collector rather than from injected agents.

Q15What happens to data if a collector Pod restarts?

Data held only in memory, such as the contents of an in-memory queue, can be lost when a Pod restarts. To reduce this risk, use persistent queues backed by storage, run several replicas, and make sure applications retry sending for a short time. Perfect delivery is rarely free, so decide how much loss is acceptable for each signal.

Q16Should I use the contrib image in production?

It is fine for learning and for quick experiments, but many production teams prefer a slim custom distribution that contains only the components they use. A smaller image has fewer parts to patch and a smaller attack surface, and it starts faster. Whichever you choose, pin an exact version.

Q17How do I roll out auto-instrumentation safely?

Begin with a few low-risk services in a test environment, measure startup time and resource use, and compare error rates before and after. Use workload-level annotations at first, set a conservative sampling rate, and widen the rollout in stages. Keep a clear way to remove the annotation and restart if a problem appears.

Q18Where should I start if I am new to all of this?

Learn the Collector first, since it is the core of the pipeline. Then install the operator in a test cluster, create one small collector, and try auto-instrumentation on a sample application. After you can see traces flowing, add the Target Allocator for metrics, and only then think about sidecars, tiers and advanced scaling.

22Summary and Key Takeaways

The OpenTelemetry Operator is a Kubernetes operator that turns written descriptions of your telemetry setup into running reality. It manages Collectors in four modes, injects automatic instrumentation into workloads without code changes, distributes Prometheus scraping fairly through the Target Allocator, and keeps everything matching your desired state through continuous reconciliation. Used well, it lets a platform team offer a consistent telemetry service to many teams, with central control over versions, endpoints and sampling.

It is not magic, and it is not free. It is a privileged component with webhooks in the Pod creation path, so it deserves careful security, monitoring, version pinning and tested upgrades. For a very small setup it may be more than you need, but for a growing platform it replaces a large amount of repetitive, error-prone manual work with a clear, reviewable and repeatable process.

If you take one habit from this guide, let it be the discipline of describing the desired state clearly and keeping that description in version control. Everything else, from choosing a deployment mode to rolling out agents in stages, becomes easier when the setup is written down, reviewed by colleagues and applied by automation, because mistakes become visible, reversible and teachable instead of mysterious.

Key Takeaways

  • Operators encode expertise — you declare the desired state, and the controller keeps reality matching it through continuous reconciliation.
  • Two big jobs — the operator manages Collectors through the OpenTelemetryCollector resource and injects agents through the Instrumentation resource.
  • Choose the mode deliberately — deployment, daemonset, statefulset and sidecar each suit different needs, and agent plus gateway is a strong default.
  • Injection happens at Pod creation — annotations must be on the Pod template, and existing Pods need a restart to receive agents.
  • Target Allocator prevents duplicate scraping — it shares Prometheus targets fairly and reuses existing ServiceMonitor and PodMonitor resources.
  • Secure it like a privileged component — restrict who creates resources, protect the operator’s service account, and encrypt and authenticate telemetry.
  • Monitor the monitors — watch the operator’s reconciliation and each collector’s accepted, refused and failed-send numbers.
  • Pin, test and review — keep resources in Git, pin exact versions, and upgrade the operator, collectors and agents one step at a time.