How Prometheus scraping on Kubernetes moves to the OpenTelemetry Target Allocator
A platform team running a Prometheus server against a growing Kubernetes cluster often reaches the point where one server handles too many scrape targets, too many series, or too much change in its scrape configuration. The Target Allocator is an extra binary deployed with the OpenTelemetry Operator that distributes Prometheus scrape targets for a configuration across a cluster of Collectors. Teams need it when they want the OpenTelemetry Collector to take over metric collection from the Prometheus server but still need the work split across several Collector instances rather than one large scraper. If the cluster is small and one Prometheus server copes, the migration adds moving parts without a clear gain, so confirm the scrape load and target count before committing.
OpenTelemetry is not an observability backend. It collects, processes and exports telemetry, but it does not store or query metrics. Those jobs still belong to a backend such as a Prometheus-compatible store, so the platform team must decide where the scraped series will land, how long they will be kept, and who will run that storage. Confirm this decision with the owners of your metrics backend before changing any scrape configuration, because it determines the exporter settings and retention the Collector pipeline must support.
What does not change is the Prometheus data model and the PromQL query language that engineers already use. Dashboards and alert rules written against those series should keep working once the Collectors export them, which is the main reason to keep the scrape configuration format familiar. Plan a comparison period in which the old Prometheus server and the Collector-based path both scrape the same targets, then check that series names, labels and values match before retiring the old server.
How targets flow from ServiceMonitor and PodMonitor to Collectors
The flow starts with ServiceMonitor and PodMonitor resources that describe which Prometheus-style endpoints to scrape. The Operator reads those resources and generates the scrape configuration for the Collector, and the Target Allocator then assigns each discovered target to exactly one Collector pod so that no endpoint is scraped twice. Each Collector pulls metrics from application endpoints inside the cluster boundary and exports them to a Prometheus-compatible back end outside it. Check that every target has one owner, and confirm that the back end's ingest path and credentials cross the boundary as you intend.
Scrape target assignment from monitor resources to Collectors and export.
Target Allocator configuration options and when each fits
The Target Allocator runs alongside the Operator and hands scrape targets to a set of Collector instances. The Collector mode you pick determines how those instances are named, addressed and scaled, and the allocation strategy determines how targets are divided among them. Confirm the current allocation strategy names and the field that selects one in the OpenTelemetry Operator documentation, because these names have changed across releases and should not be copied from older examples.
- StatefulSet mode: Each Collector pod has a stable identity, which suits per-target assignment and makes it easier to reason about which instance scrapes which target. The trade-off is slower scaling and more care during rollouts.
- Deployment mode: Pods are interchangeable and scale more freely. Assignment still comes from the Target Allocator, but you give up stable identity, which matters if you rely on pod names in dashboards or runbooks.
- Allocation strategy choice: The strategy controls how evenly targets spread and how much they move when a Collector is added or removed. Test rebalancing before you depend on it for a large target set.
- Replica count: More replicas only help if the strategy spreads targets across them. Check per-instance memory and series counts after the split.
- Scale events: Ask the Operator documentation how targets are redistributed during scale-up and restarts, since that is when duplicate or missed scrapes are most likely.
Before you commit, confirm the mode and strategy against the version of the Operator you plan to run.
The Operator reads Prometheus Operator custom resources to discover what to scrape. A ServiceMonitor selects Kubernetes Services and scrapes the endpoints behind them, which fits applications that already expose a Service for their metrics. A PodMonitor selects Pods directly, which fits workloads without a Service, such as batch jobs or sidecars. Both change which objects your teams must label and maintain, so the choice is as much about ownership as about technology.
- ServiceMonitor: Targets follow Service membership, so scraping stays correct when pods are replaced. Teams need a Service in front of every metrics endpoint.
- PodMonitor: Targets follow pod labels, which can produce more targets than a Service-based setup and may need tighter selectors.
- Existing CRDs: If you already run Prometheus Operator resources, reuse them. Rewriting them for a different discovery model adds migration work without new coverage.
- Label discipline: Selector mismatches are the most common cause of missing targets. Agree on labels before teams create monitors.
- Mixed use: Many clusters use both, and the Target Allocator must be configured to read both kinds of resource.
Confirm which resource kinds your Operator version reads and how it selects them in its current documentation.
Teams often ask whether the Target Allocator should replace a Prometheus server or run beside it during a transition. Prometheus stores data in a local time series database that is not clustered or replicated, so moving scraping for some jobs at a time is a common way to limit risk. The coexistence choice decides who scrapes each target, and a target scraped by both systems produces duplicate series that distort queries and alerts.
- Full replacement: One scraping path, simpler ownership, and a single place to fix problems. It requires that every job is migrated and verified at once.
- Staged split: Move selected jobs to Collectors and keep the rest on Prometheus. This lowers risk but needs a clear rule for which system owns each job.
- Duplicate-scrape prevention: Each target must be assigned to exactly one scraper. Check that the Prometheus configuration no longer scrapes jobs moved to Collectors.
- Alerting continuity: Alert rules that depend on series from one system must be checked against the other before the switch.
- Retention: Existing Prometheus data stays where it is unless you plan its migration or remote storage.
Before switching any job, confirm with your team that each target has one owner and that alert queries return the same results on both paths.
Setup sequence for Target Allocator scraping with checks
This sequence moves Prometheus scraping from a standalone server to Collectors that receive their target assignments from the Target Allocator, with a check at each step that confirms scraping is working before the old jobs are switched off. The result is a set of targets scraped once, by Collectors you can inspect and verify.
Install the Operator and its custom resource definitions
The platform or cluster team installs the OpenTelemetry Operator into the cluster, which also registers the custom resource definitions the rest of the sequence depends on, including the Collector resource. Confirm the installation by checking that the Operator deployment is running and that the Collector custom resource definition is present in the cluster. Also confirm that the Operator's admission webhooks and certificate handling work in your environment, since the Collector resource is validated through them. Record the Operator version so it can be matched to the Collector image version in the next step.
Deploy a Collector with the Target Allocator enabled
Create an OpenTelemetry Collector custom resource with the Target Allocator enabled and a Prometheus receiver in its pipeline. The Target Allocator runs as a separate deployment that the Operator manages, and it distributes the scrape targets that the Prometheus receiver would otherwise load on its own. Start with a single Collector replica so the distribution logic is easy to inspect. Check that the Target Allocator pod and the Collector pods are running, and that the Collector logs show the Prometheus receiver starting without configuration errors.
Add ServiceMonitor and PodMonitor selectors
Configure the Target Allocator to select the ServiceMonitor and PodMonitor resources your teams already use, by namespace and label selector. Start with a narrow selector covering one namespace so the first assignments are easy to audit, then widen it later. Confirm that the Target Allocator lists the monitors it matched and that the monitor count agrees with what you expect from
kubectl get servicemonitorsandkubectl get podmonitorsin that namespace. Mismatched counts usually point to a selector or namespace scope problem.Grant RBAC for discovery and target access
Create the service accounts, cluster roles and bindings that let the Target Allocator read ServiceMonitor, PodMonitor, Service, Endpoints or EndpointSlice and Pod objects, and let the Collector read the same objects where its receiver needs them. Keep the permissions to read-only verbs on the namespaces in scope. Check the grants with
kubectl auth can-iusing each service account, and confirm that the Target Allocator reports target assignments rather than permission errors in its logs. Missing list or watch permissions tend to appear as silently empty target sets, so check the assignment output, not only the pod status.Run the new Collectors alongside the Prometheus server
Before turning anything off, let the Collector scrape in parallel with the existing Prometheus server. Do not disable the old scrape jobs yet. Compare the list of targets each system reports as up, and the series produced for a sample of jobs, over a period your team agrees is long enough to cover normal metric churn. Expect some differences in metric naming and labels between the Prometheus receiver and the Prometheus server, and record them so dashboards and alert rules can be adjusted. Do not treat the parallel run as complete until the target lists match for the in-scope jobs.
Disable the old Prometheus scrape jobs
Remove the scrape configuration for the in-scope jobs from the Prometheus server, or retire the server for those jobs, in a controlled change with a rollback plan. Make the change one namespace or job group at a time, following the scope used in the earlier steps. Confirm that the old server no longer lists those targets, and that the Collector still reports them as up. If the Prometheus server also runs alerting rules, check that each rule still has a working source of data before it is removed or moved.
Verify each target is scraped exactly once
Confirm that every target appears in exactly one Collector's assignment, which the Target Allocator exposes through its own endpoints and logs, and that no target is scraped by both the Collector and any remaining Prometheus job. Check for duplicate series by comparing series counts for representative jobs before and after the switch, and look for sudden doubling in any job. Also confirm that scaling the Collector replicas redistributes targets without leaving any unassigned. Record the results so the check can be repeated after upgrades or changes to monitor selectors.
How to avoid duplicate scrapes during a Prometheus migration
Duplicates appear whenever a Prometheus server and a Collector both scrape the same target during the overlap. Each source sends its own copy of the same series, so queries double-count, rate calculations and alerts can fire twice, and dashboards become hard to trust. The safest plan is to treat the migration as a job-by-job cutover rather than a single switch. Inventory every scrape_configs job and every ServiceMonitor and PodMonitor on the cluster, mark each one with an owner and a cutover state, and confirm that the Target Allocator's prometheusCR discovery and the Collector's prometheus receiver configuration cover exactly the set of jobs you intend to move. Keep the old Prometheus server scraping everything until a job has been validated on the Collector side.
During the parallel run, use labels to separate the two sources. Add a distinguishing external label or a Collector resource attribute such as service.instance.id or a custom cluster label, so that a query can select one pipeline or the other. On the Collector side, metric_relabel_configs and relabel_configs in the receiver can drop or rename series that would collide with existing names, and the transform or resource processors can add a source tag. Verify before cutover by comparing the same query against both sources, expecting the difference to be only the label you added. Confirm with your Operator and Collector versions that the relabeling fields behave as you expect, since the Target Allocator and receiver behavior should be checked against the release you deploy.
Cut over one job at a time: disable the scrape in the Prometheus server, confirm that the Collector series are complete and that alerts still evaluate, then remove the old job. Keep rollback simple by retaining the old configuration until the job has run cleanly through a full set of alert evaluation and dashboard review cycles that your team has agreed on in advance. Record the cutover order and owners in the migration plan so that nobody disables a scrape that another team still depends on. Ask your vendor or DeployOpen engineer to confirm the exact duplicate-detection queries you will run against your own environment before the first job moves.
Security and operational controls for Collector scraping
Moving Prometheus scraping into Collectors and the Target Allocator adds new components that read cluster configuration, hold scrape credentials and expose endpoints. The controls below cover who can read monitor objects, how Collector configuration and credentials are protected, and how the Collector reports on its own health. Review them together before the Collector goes into production.
RBAC for monitor and endpoint reads
The Collector service account needs read access to ServiceMonitor and PodMonitor objects, Services, Endpoints, EndpointSlices and Pods in the namespaces it scrapes. Grant that access with a ClusterRole only where discovery spans namespaces, and bind it to the Collector's own service account rather than a shared identity. Check the effective permissions with a dry-run of the service account, and confirm that no workload can edit monitor objects to redirect scraping to an arbitrary target.
Kubernetes authenticationProtecting Collector configuration
Generated scrape configuration can reveal internal service addresses, job names and credential file paths, so treat it as sensitive. Store the Collector configuration in a Kubernetes Secret or a managed config resource with restricted read access, and avoid placing bearer tokens or passwords inline. The OpenTelemetry security guidance recommends storing configuration securely and protecting it with encryption and authentication, so confirm both before rollout.
Collector security best practicesScrape credentials and TLS
Targets that require bearer tokens, basic authentication or client certificates need those credentials mounted from Secrets, not embedded in scrape configs. Kubernetes stores Secrets unencrypted in etcd by default, so confirm encryption at rest is enabled and that list and watch access is limited to the namespaces that need it. Use TLS for scrapes that cross node or namespace boundaries, and document which CA each job trusts.
Secrets good practicesPod Security settings for Collector pods
Collector pods should run under the Pod Security Standards level your cluster enforces for the namespace, with no privilege escalation, a read-only root filesystem where the image allows it, and a non-root user. Check which Collector image and distribution you run, since the contrib build includes more receivers and a wider attack surface. Build a minimal Collector with only the components your scrape jobs need, and confirm the image signature and checksum before deployment.
Pod Security StandardsCollector endpoint exposure
Confirm which Collector ports are reachable from outside the pod and from other namespaces. Since Collector v0.110.0, server components bind to localhost by default, so any change to bind addresses or service exposure should be reviewed as a deliberate decision. Restrict Service and network policy access to the scrape and telemetry ports, and enable authentication extensions on receivers where the Collector accepts remote connections.
Collector configurationMonitoring the Collector itself
A Target Allocator that silently drops targets looks healthy from the outside, so watch the Collector's own telemetry. Alert on scrape failures, targets that disappear from allocation, dropped data and restarts, and compare the number of discovered targets with the number actually scraped. Pin the Collector and Operator versions you tested, and track the release notes for breaking changes to scrape configuration handling before upgrading.
Questions teams ask before replacing Prometheus scraping
What drives the effort and cost of replacing Prometheus scraping with Collectors?
The main drivers are how many scrape jobs and targets exist, how many ServiceMonitor and PodMonitor objects the current setup relies on, and how much relabeling logic is embedded in the existing Prometheus configuration. Each job has to be translated, tested against the same targets and compared with the metrics the old server produced. Cost has two parts: the people time to plan, build and verify the pipeline, which is mostly one-time, and the ongoing infrastructure to run Collectors, the Operator and the Target Allocator, which recurs. Ask any partner to price the inventory of jobs and relabel rules separately from the build and the run period. Prometheus itself is Apache-2.0 licensed, so software licensing is not a cost driver; the work is in the people and the infrastructure.
How long does a Prometheus to Target Allocator migration take?
Duration depends on the size of the scrape inventory, how many clusters are involved, how well existing relabeling rules are documented, and how long the team needs to run old and new scraping side by side. No duration is set by a researched source, so treat any timeline as a question for your own environment. The steps that most often extend the schedule are reconciling duplicate series during parallel running, agreeing on the Operator and Collector versions to standardize on, and getting change approval for the cutover. Ask for a written plan that separates inventory, build, parallel run and cutover, with an exit check for each.
What does the migration need from our platform and monitoring teams?
The work needs access to the clusters, a clear owner for the Prometheus configuration, and people who know which dashboards, recording rules and alerts depend on each metric. The Operator and Collectors also require Kubernetes permissions to read ServiceMonitor and PodMonitor objects and the services or pods behind them, so someone must approve RBAC and service accounts. Your team should also decide where Collectors run, how their configuration is stored and who reviews changes. Gather a list of consumers of current metrics before the build starts, because that list determines which series must match during verification.
Can our platform team run this migration without an outside partner?
A platform team with Kubernetes, Prometheus and OpenTelemetry experience can do it, and the Target Allocator documentation describes it as an extra binary deployed with the Operator that distributes scrape targets across a cluster of Collectors. The harder parts are usually not the installation but the verification: proving that metric names, labels and counts match what dashboards and alerts expect, and handling edge cases in relabeling. Teams with limited time or no recent experience with the Operator often bring in a partner for a fixed scope covering inventory, build, parallel run and cutover. Decide this by comparing your team's available hours against the inventory size, and get a written scope before work starts, since DeployOpen engagements are typically fixed-scope.
Are existing ServiceMonitor and PodMonitor objects reused after the switch?
In many cases they can be, because the Target Allocator uses ServiceMonitor and PodMonitor discovery to find scrape targets, so existing monitor objects are a natural starting point. Confirm this against the Operator version you plan to run, since discovery behavior and supported fields depend on the release. Some monitors will need changes, for example where they rely on relabeling that the Collector handles differently, or where several monitors would scrape the same endpoint. The Target Allocator's purpose is to split targets across Collectors so each one is scraped once, which is how duplicate scrapes are avoided. Review every monitor object during inventory and record which ones are kept, changed or retired.
What changes for alerting when Prometheus scraping moves to Collectors?
Alert rules and Alertmanager routing can stay in place only if the metrics they query keep the same names, labels and values after the switch. Prometheus still evaluates rules and sends alerts to Alertmanager in many setups, but the source of samples changes, so the first check is whether the series match. Prometheus stores data in local two-hour blocks with a default retention of 15 days and is not clustered or replicated, so any alert history or recording rules you rely on need a plan for storage. Alertmanager can run as a cluster for high availability, and Prometheus should point at every Alertmanager instance rather than a load balancer. Add alert comparison to the parallel run so that firing alerts are checked against the old setup before cutover.
What should we confirm about Collector versions before choosing a design?
Confirm which Collector release and Operator version you will standardize on, because component stability varies and the Target Allocator and discovery features depend on the release. The OpenTelemetry Collector repository is Apache-2.0 licensed, and releases ship the contrib distribution with signed artifacts, SHA256 checksums and SBOM files, which helps with supply chain review. Core components have mixed stability levels documented in each component's README, so check the status of every receiver and processor in your design. Also confirm your Kubernetes version against the supported minor releases, since the Operator and Collectors must run on a version your platform still receives patches for.
What DeployOpen scopes and delivers for this migration
Most migrations of Prometheus scraping onto Collectors are scoped as a fixed-scope engagement, with the scope, deliverables and timeline agreed in writing before any work starts. The written scope names the clusters in play, the scrape jobs being moved, the backends that will receive the data, and what stays on the existing Prometheus server during the transition. DeployOpen does not publish a price list, so a quote follows from that written scope. Ask for the quote to break out the inventory, the build, the parallel run and the handover as separate line items, so you can see which parts are one-time work and which recur.
The first phase is an inventory of existing scrape jobs. This covers every scrape_configs entry, every ServiceMonitor and PodMonitor, relabeling rules, authentication settings for each target, and any recording or alerting rules that depend on the current series names. The output is a list that shows which targets map cleanly onto the Operator's TargetAllocator and which need a manual rewrite. The build phase then sets up the OpenTelemetry Operator, the Collector custom resource with the Target Allocator enabled, and the Collector image, using a Collector distribution that includes only the receivers and exporters your scope needs. Confirm with DeployOpen which Collector release and Operator version the build will pin, and how they will be upgraded later.
Verification runs the Collector pipeline alongside the existing Prometheus server, comparing series counts, label sets and scrape health for the same targets over a period you agree in the scope. Any duplicate series or missing target is traced back to a configuration fact before cutover. Cutover switches alerting and dashboards to the new series and retires the old scrape jobs in stages. Handover delivers the configuration as code, runbooks for scrape failures and Target Allocator issues, and the list of open items. Ongoing upgrades, continuous testing and support are available as retainers, and these are scoped and priced separately from the migration.
How DeployOpen approaches OpenTelemetry on Kubernetes
DeployOpen plans and builds Prometheus scraping on Kubernetes with the OpenTelemetry Target Allocator inside your own clusters and networks. The work starts with a written scope that covers which Prometheus jobs move, how ServiceMonitor and PodMonitor resources are discovered, and how duplicate scrapes are prevented before any Collector is switched on.
How we scope
- Inventory every Prometheus scrape job, ServiceMonitor and PodMonitor that the Collectors will take over from the existing server.
- Confirm the Operator version, Collector distribution and Target Allocator settings that match your clusters and release policy.
- Agree in writing which series, retention and remote write paths stay with the current Prometheus server during the transition.
How we build
- Deploy the Operator and Target Allocator, then configure one scrape pipeline at a time and compare target counts against the existing server.
- Set RBAC for service discovery so Collectors can read only the namespaces and resources in the agreed scope.
- Test for duplicate scrapes, missing labels and dropped series, and record each result before the next job moves.
How we hand over
- Deliver the Collector and Operator manifests or Helm values, with the discovery rules and label mappings documented for your team.
- Provide a runbook covering target allocation, adding new monitors and rolling back a job to the original Prometheus server.
- Walk your platform and monitoring engineers through the build and the verification evidence so they can operate it without us.
How we support
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
- Ongoing support, Collector and Operator upgrades and continuous testing are available as a retainer.
- Confirm with your team which Collector and Operator releases your clusters will track before choosing a support level.

