Moving Prometheus from VMs to Kubernetes with the Prometheus Operator

A VM-based Prometheus and Alertmanager can move to Kubernetes without losing alerting, provided scrape jobs, rules and history are translated deliberately and both systems run in parallel before cutover. This page explains what maps cleanly, what does not, and how the work is sequenced.

On this page

What moving Prometheus from VMs to Kubernetes involves

Moving a VM-based Prometheus and Alertmanager to Kubernetes is mostly translation and parallel running, not new software. The Prometheus project is licensed under Apache-2.0 and has no paid edition, so the cost of the move comes from the people doing the work, the Kubernetes capacity and persistent storage that will hold the server and its data, and the time your team spends running two monitoring stacks side by side. Effort is driven by how much configuration has accumulated on the existing servers: the number of scrape jobs, static targets and file-based service discovery entries, the size of the rule files, and the number of Alertmanager receivers, routes, inhibition rules and silences. A small estate with a handful of jobs is a short exercise. A large estate with years of hand-edited rules is a longer one, and the reader should ask any partner to size the work from an inventory of those files rather than from a headline figure.

The core work is converting scrape configuration into ServiceMonitor, PodMonitor and ScrapeConfig resources, moving rule files into PrometheusRule objects, and reproducing Alertmanager routing in the operator's configuration. Each of these conversions changes how targets are selected and labeled, so a scrape job that worked on a VM can quietly produce different label sets in the cluster. The team also has to decide what happens to the existing time series. Local storage on a single Prometheus server is not clustered or replicated, and its default retention is 15 days, so history that matters for capacity planning or audits will need a plan before the old server is switched off, such as remote write to long-term storage or keeping the old server read-only for a defined period. Confirm which alerts must keep firing during cutover, who signs off on the switch, and how the old Alertmanager is silenced without losing pages. Review the Prometheus storage documentation and the Alertmanager documentation before setting these decisions.

Which VM-based Prometheus settings map to Operator resources

This table compares each part of a VM-based Prometheus and Alertmanager configuration with its counterpart in a Prometheus Operator setup on Kubernetes. Read the middle column for the target resource and the last column for settings that need a deliberate redesign rather than a direct copy. The main takeaway is that scrape, rule and Alertmanager settings translate fairly directly, while retention, file-based targets and external targets need decisions before cutover.

Current VM settingOperator resourceMapping notes
static_configs in scrape_configsServiceMonitor or PodMonitorTargets that are Kubernetes Services or Pods move to these resources. Label selectors and port names replace hard-coded host:port pairs, so confirm each target exposes a named port.
file_sd or cloud service discoveryScrapeConfigDiscovery blocks that do not fit ServiceMonitor or PodMonitor usually move to ScrapeConfig. Confirm each discovery mechanism is supported by the operator version you deploy before planning the move.
Custom relabel_configsServiceMonitor, PodMonitor or ScrapeConfig relabelingsSimple label rewrites carry over. Complex chains, regex edge cases and actions that depend on original discovery labels often behave differently, so test them against live target metadata.
rule_files and rule groupsPrometheusRuleEach rule file becomes one or more PrometheusRule objects. Check that the rule file selector on the Prometheus resource matches the labels you set, or rules will load silently into nothing.
Alertmanager alerting block and alertmanager.ymlAlertmanager resource plus a config secretThe Alertmanager resource sets replicas and cluster behavior, and the routing and receiver configuration lives in a referenced secret. Receiver credentials must move into Kubernetes secrets, with access restricted by RBAC.
Local retention (15-day default, time or size)Prometheus storage spec and retention settingsRetention and volume size are set separately on Kubernetes. Confirm the chosen persistent volume can hold the retention you need at your ingest rate, since the 15-day default is only a default.
Remote targets outside the clusterStatic endpoints via ScrapeConfig or additional scrape configsHosts outside the cluster have no Service to select. Plan network paths, firewall rules and certificates for them, and confirm they remain reachable from the Prometheus pods.
File-based targets (file_sd JSON or YAML files)No direct equivalent, usually replaced by ScrapeConfig or a generatorFiles written by hand or by a job on a VM need a different source of truth in Kubernetes, such as a generated ScrapeConfig or a configuration pipeline. Confirm who owns the generator and how it is reviewed.
Local history after cutoverRemote write or retained VM volumeMoving to a new persistent volume does not carry old blocks automatically. Decide whether to keep the old server read-only, use remote storage or backfill history before the cutover window.

How the Prometheus Operator changes the deployment model

On VMs, a Prometheus server reads one configuration file and runs as a single process that you start, reload and watch yourself. With the Prometheus Operator, you declare the desired state as Kubernetes objects and a controller reconciles them into the running pieces. A Prometheus resource describes the server, and the Operator creates a StatefulSet for it, along with its configuration secret and services. Scrape definitions move out of the main file into ServiceMonitor, PodMonitor and ScrapeConfig resources, and alerting rules move into PrometheusRule objects. The Operator collects the selected objects and renders them into the configuration the server loads.

  • Selectors decide what is collected: The Prometheus resource uses label selectors to pick which monitors and rules it includes, so a misplaced label silently drops a target.
  • Generated configuration replaces hand edits: Changes go through Kubernetes objects, not the rendered config file, which the Operator overwrites.
  • Storage is a claimed volume: Each replica has a persistent volume claim, so the storage class and reclaim policy become part of the design.
  • Versions are pinned in the custom resource: The Operator and the Prometheus image are separate versions that you must match against its compatibility table.
  • Reconciliation can fail quietly: Invalid objects are often rejected at apply time, but some errors show only in Operator logs or resource status.

Before cutover, confirm the Operator version, supported Prometheus versions and selector labels in the release you plan to use, and check the current resource status fields in your cluster.

Documented import and translation paths

Moving a VM-based Prometheus onto Kubernetes is mostly translation: scrape jobs become Operator resources, rule files become PrometheusRule objects, and history is brought in through block creation. Each path below has its own validation step, and each one should be confirmed against the Operator and Prometheus versions you plan to run.

Operator resource model

The Prometheus Operator replaces hand-edited scrape configuration with custom resources. ServiceMonitor and PodMonitor select Kubernetes Services and Pods, while ScrapeConfig covers scrape jobs that do not map to either, such as static or external targets. Map each existing job to one of these, and note which labels and relabeling rules the old job depended on. The Operator project documents its own CRD schemas, so check field names against the version you install.

Prometheus overview

Rules as PrometheusRule objects

Recording and alerting rules move from rule files into PrometheusRule resources, which the Operator loads into the generated configuration. Keep the PromQL unchanged and confirm each rule still evaluates, since label names and job values often shift when targets move into the cluster. Validate every rule group with promtool before it is applied, and keep the source in version control so the same file can be checked in CI.

Configuration reload and validation

Use promtool to check configuration and rule files before they reach a running server, and treat a failed check as a blocking step in the pipeline. Reloads behave differently on a VM and under the Operator, which regenerates configuration from resources. Confirm the reload mechanism for your Operator release and the flags that control lifecycle endpoints on the server, since those endpoints are disabled unless enabled explicitly.

Backfilling history into TSDB blocks

Existing history can be moved with promtool backfilling, which converts exports to OpenMetrics and writes TSDB blocks. The local storage default retention of 15 days means older data is absent unless you import it. Blocks must be placed in the data directory in a way the server can read, and recording rules that depend on historical series need blocks created for them. Test the import against a copy of the new server first.

Prometheus storage docs

Version alignment and confirmation

Check the Operator release you install against the Prometheus version it deploys, the Kubernetes version your cluster runs, and the promtool binary you use for validation. Flags, CRD fields and backfill behavior change between releases, so record the exact versions in your runbook. Ask your Operator and Prometheus maintainers to confirm current flags before you copy any example into production, and keep one reference environment that mirrors production versions.

Prometheus releases

How the old and new Prometheus stacks run side by side

The diagram starts with the existing VM-based Prometheus and Alertmanager, which keep scraping shared targets and sending notifications while the Kubernetes stack is built and validated. Each scrape target is reached by both stacks, so the two sets of metrics can be compared before anything is switched. The cutover point is where notification receivers move from the old Alertmanager to the new one, and the trust boundary marks the network path between the VM network and the cluster. Check that both stacks evaluate the same rules, that receivers point at exactly one Alertmanager at a time, and that any remote write target accepts samples from both sides.

Old and new stacks scrape the same targets, with one notification cutover point.

Sequence for inventory, parallel run and alert cutover

This sequence moves a VM-based Prometheus and Alertmanager onto Kubernetes without a gap in monitoring or alerting. Each step produces a checked artifact, so the team knows what has moved, what is duplicated and when the old instance can be retired.

  1. Inventory scrape jobs, rules, receivers and silences

    Export the running configuration from the VM instance, including every scrape job, service discovery block, relabeling rule, recording rule, alerting rule file, Alertmanager route, receiver and active silence. Record which jobs use static targets, which use service discovery and which rely on exporters that take targets from URL parameters, since those need separate review. The team that owns each alert and receiver should confirm its entry. The step is done when every job and rule has an owner and a target resource type (ServiceMonitor, PodMonitor, ScrapeConfig or PrometheusRule) in a shared inventory.

  2. Build the Kubernetes platform and etcd backups

    Where the platform team does not already operate a cluster, stand up the control plane first. The kubeadm high availability guide describes a stacked topology with etcd on the control plane nodes or an external etcd cluster, with at least three control plane nodes and a TCP load balancer in front of kube-apiserver on port 6443. Etcd should run with an odd number of members, and a tested snapshot schedule must exist before any monitoring workload lands. Confirm authentication, encryption at rest for Secrets and the Prometheus Operator installation in a test namespace. The step is done when a restore from an etcd snapshot has been rehearsed in a non-production cluster.

  3. Translate a pilot job set into operator resources

    Choose a small group of low-risk jobs, such as node exporters on a non-critical host group, and rewrite them as ServiceMonitor or PodMonitor resources, with ScrapeConfig used where a job cannot be expressed through those objects. Move the matching rule groups into PrometheusRule objects and validate them with promtool before applying. Label selectors on the Prometheus custom resource must match the new monitors, which is a common reason targets silently do not appear. The step is done when the pilot targets show as up in the new instance and the rules evaluate with the same results as the VM instance over a comparison window.

  4. Run both instances in parallel scraping

    Keep the VM instance running and let the Kubernetes instance scrape the same targets, so that series can be compared side by side. Compare target health, sample counts, label sets and rule outputs for each job, and resolve differences in relabeling before continuing. Decide in advance how long-term history will be kept, either through remote write to an external store or by retaining the VM data directory for reference, because the local storage of each instance is not clustered or replicated. The step is done when each migrated job shows matching series and no unexplained gaps.

  5. Review duplicate alerts from both instances

    While both instances evaluate the same rules, every alert will fire twice, once from each Prometheus. Route the Kubernetes instance alerts to a staging receiver or a silenced route, then review each pair to confirm the same condition, the same severity and the same labels. Confirm that Alertmanager on Kubernetes is configured with all instances in its cluster settings, since Prometheus should point at every Alertmanager instance rather than a load balancer. The step is done when the duplicate review has a signed-off list of alert pairs and any differences are fixed in the rule files.

  6. Cut over Alertmanager receivers

    Move receivers in a planned window, one route at a time, starting with low-severity notifications. Disable the matching receiver on the VM Alertmanager only after the Kubernetes route has delivered a test notification to the same destination, and recreate active silences and inhibition rules in the new instance, since silences do not transfer automatically. Check that the Kubernetes Alertmanager cluster has the expected peers and that delivery continues if one replica is restarted. The step is done when every production receiver is served from Kubernetes, the VM Alertmanager sends nothing and the on-call owners have confirmed delivery.

  7. Decommission the VM instance after a retention window

    Stop the VM Prometheus only after the agreed retention window has passed and the history needed for audits, incident reviews and capacity planning is available from the new location or an archive. Keep the configuration, rule files and data directory in read-only storage for the period your policy requires, and remove network access to the old exporters and admin endpoints. Confirm the decision with service owners and record it in the change log. The step is done when the VM host is removed from scrape configuration, the archived data has been tested for readability and the decommissioning record is complete.

What drives the cost and duration of the move

This table compares the factors that change the effort of moving a VM-based Prometheus and Alertmanager onto Kubernetes, and what each one costs to address. Read it against your own estate: the more jobs, rules, receivers and history you carry, the longer translation and validation take. The main takeaway is that the one-time move and the recurring operation of the cluster are priced separately, so ask for both.

DriverWhy it changes cost or effortHow to keep it down
Number of scrape jobs and targetsEach static job or file_sd target must be mapped to a ServiceMonitor, PodMonitor or ScrapeConfig and checked for label parityRetire unused jobs before the move and group similar targets under shared selectors
Number of alerting and recording rulesEvery rule file becomes a PrometheusRule and each expression needs re-testing against the new series labelsRemove dead alerts first and convert rules in batches by owning team
Custom relabeling and metric_relabel_configsRelabeling logic often has to be rewritten because Operator-generated labels such as namespace and pod differ from VM labelsDocument each relabel rule and confirm which ones still apply on Kubernetes
Alertmanager receivers and routing treeEach receiver, route and inhibition rule must be reproduced and tested against live notification channelsExport the current configuration and validate it on a staging cluster before cutover
Existing Kubernetes platformIf no cluster exists yet, the work includes cluster build, etcd backups and access setup, which adds one-time and recurring effortConfirm whether the client already runs a supported cluster and its upgrade pattern before scoping
Metric history requirementsKeeping history means a remote storage target or a planned migration of old blocks, which adds storage cost and validationDecide how much history is needed for dashboards and audits, and keep only that range
Clustered Alertmanager and high availabilityRunning several Alertmanager instances needs cluster settings and a check that every Prometheus points at each instanceConfirm the required HA level in writing and test failover during validation
SSO, TLS and access in front of the UI and APIPrometheus has no built-in SSO, so an authenticating reverse proxy and certificates must be designed and testedAgree the identity provider and certificate source early, since they touch many components

Questions teams ask before moving Prometheus to Kubernetes

What does it cost to move Prometheus from VMs to Kubernetes?

The software itself has no license fee, because Prometheus is licensed under Apache-2.0 and there is no paid enterprise edition of the project. The cost comes from four places: the Kubernetes cluster and its nodes, persistent storage for the time series database, the engineering time to translate scrape jobs and rules and cut over alerting, and the staff who run the result afterward. Build costs are one-time. Compute, storage, backup capacity and on-call time recur. The main cost drivers are the number of targets, the number of rules, how long history must be kept, and how many Alertmanager instances and remote storage components are needed. Ask any partner for a quote built from a written scope that lists these items separately.

How long does a move like this take?

The duration depends on the size of the estate, the number of scrape jobs and rules, how many teams consume the alerts, and whether a Kubernetes platform already exists. The work usually runs in phases: inventory of jobs and rules, building the Kubernetes platform, translating configuration into Operator resources, a parallel run, and then cutover and decommissioning. The parallel run is often the longest phase because alerts must be compared before the old server is switched off. Confirm the timeline in writing against your own inventory rather than relying on a general estimate.

What must our internal team provide before the work starts?

Your team needs to supply an inventory of scrape jobs, targets, service discovery sources, rule files, Alertmanager receivers and routes, and the owners who respond to each alert. It also needs access to the current VM-based Prometheus configuration, the Kubernetes cluster or the decision about where it will run, identity and certificate authorities, and a storage plan with a retention target. Named approvers for cutover and a window in which alerts can be compared are equally important. Missing ownership data is the most common cause of delay, because nobody can decide which alerts must survive the move.

Can our own team do this migration without a partner?

Yes, if the team already runs Kubernetes in production, understands Prometheus configuration, and can dedicate people to the parallel run. The Prometheus Operator uses custom resources such as ServiceMonitor, PodMonitor, ScrapeConfig and PrometheusRule, so engineers need to learn how those map from the existing configuration. Teams without recent Kubernetes operations experience often find the cluster itself, not Prometheus, is the larger effort. A partner is most useful when the scope includes platform hardening, security review or a fixed-scope delivery with written deliverables. Decide based on your skills inventory and capacity, not on the tooling alone.

How do we keep history when local retention is 15 days by default?

Prometheus stores data in a local time series database organized into two-hour blocks, and the default retention is 15 days. Local storage is not clustered or replicated, so it should not be treated as the archive. To keep history, you can keep the old VM-based server running read-only for the period you need, or send samples to external long-term storage through the remote write protocol. Recording rules and dashboards also need to be checked after the move. Decide the retention period with the teams that rely on historical comparisons, and confirm how existing data will be backed up before the old server is retired.

How do we avoid duplicate alerts during the parallel run?

Duplicate alerts happen when the old and new Prometheus both evaluate the same rules and send to the same receivers. Plan the parallel run so that only one Alertmanager path notifies people at a time. One approach is to route the new stack's alerts to a test receiver or a silenced route until the rules have been compared, then switch the production route in a single controlled change. Alertmanager supports grouping, inhibition and silences, which help during the switch, and it can run as a cluster for high availability. Prometheus should point at every Alertmanager instance rather than a load balancer. Write down the cutover order and the rollback step before the parallel run begins.

Does moving to the Operator change our security responsibilities?

Yes. The Operator adds Kubernetes responsibilities on top of Prometheus responsibilities. Kubernetes authenticates users with X.509 client certificates, bearer tokens, webhook authentication or an authenticating proxy, so access to the cluster becomes part of the Prometheus access model. Secrets are stored unencrypted in etcd by default, so encryption at rest and least-privilege RBAC for list and watch access need to be configured. Prometheus itself has no built-in single sign-on, so an authenticating reverse proxy is usually placed in front of the UI and API. Admin APIs are disabled by default and should stay that way. Exporters that take targets from URL parameters can be abused by anyone with HTTP access. Review these controls with your security team before cutover.

What usually goes wrong during the cutover

Most failed Prometheus cutovers come from a few predictable gaps: alerts that fire twice or not at all during the parallel run, state that never made it across, and a new Kubernetes service that is more reachable than the VM it replaces. Each card names one failure and the check that prevents it.

Duplicate or missing alerts in parallel

While the VM and Kubernetes stacks run side by side, both sets of rules evaluate and both Alertmanagers may notify, so on-call receives duplicates. The reverse happens when a rule is ported with a changed name, label or threshold and never fires. Before cutover, compare the alert names, label sets and receivers from both stacks, and confirm that only one Alertmanager route is live for each receiver. Keep a written list of which stack owns paging at each stage.

Silences and inhibition not carried over

Silences are stored in the Alertmanager that received them, and inhibition rules live in its configuration. A rebuilt Alertmanager starts with neither, so maintenance windows that suppressed noise can suddenly page the team, and dependency rules that hid child alerts behind a failed parent stop working. Export the active silences and the inhibition rules from the VM instance, recreate them in the new configuration, and test one parent and child alert pair before retiring the old instance.

Alertmanager docs

Alertmanager cluster misconfiguration

Alertmanager high availability depends on its cluster flags so that peers share state and deduplicate notifications. Running several replicas without peering sends every alert from every replica, while placing a load balancer in front of Alertmanager breaks the model. Prometheus should list every Alertmanager instance directly. Check peer membership after each restart, and send a test alert while one replica is down to confirm that a single notification still arrives.

Local storage treated as replicated

The Prometheus storage model is a single-node local database. It is not clustered or replicated, so a pod rescheduled without its persistent volume starts with empty history, and a lost volume loses everything not yet shipped elsewhere. Teams often assume the Kubernetes deployment is durable by default. Confirm the storage class, reclaim policy and volume snapshot process, decide the retention period, and state in the runbook that history is protected by backups or remote write, not by replicas.

Default retention
15 days
Storage docs

Admin and lifecycle endpoints exposed

The admin API is disabled by default, but teams often enable --web.enable-admin-api to backfill or delete series during migration and forget to turn it off. The --web.enable-lifecycle flag adds reload and shutdown endpoints. A Service of type LoadBalancer or an unauthenticated Ingress can expose these to every network that can reach it. Keep both flags off in the final manifest, restrict the Service to internal networks, and put an authenticating proxy in front of the UI and API.

Security model

Exporters that accept URL targets

Blackbox and SNMP exporters take their targets from URL parameters, so anyone who can reach them over HTTP can make the exporter send requests to arbitrary hosts, including internal services. Moving these exporters into a cluster can widen that reach through pod networks and ingress rules. Limit access with NetworkPolicy so that only the Prometheus pods can call them, avoid publishing them through an Ingress, and review which probe modules and targets each job defines.

Unplanned Kubernetes upgrade skew

The cluster's control plane must be upgraded one minor version at a time, and kubelets may lag kube-apiserver by up to three minor versions. A Prometheus Operator release that targets a newer Kubernetes API can therefore break on a cluster that was upgraded for unrelated reasons during the migration window. Record the cluster version, the operator version and the scheduled cluster upgrade dates before cutover, and pin the operator to a version tested against the cluster you run.

Maximum kubelet lag
3 minor
Version skew policy

Securing the new Prometheus on Kubernetes

Moving Prometheus onto Kubernetes does not add security controls that the VM setup lacked, so the work is to rebuild the controls that Prometheus expects you to supply. Prometheus has no built-in single sign-on, and its security model notes there is no built-in CSRF protection on mutating endpoints. The normal pattern is an authenticating reverse proxy in front of the web UI and API, deployed as a Service and Ingress in front of the Prometheus and Alertmanager Services. Decide which identity provider the proxy uses, confirm that the proxy enforces authentication on every path including the query API, and check that no Service for Prometheus is exposed directly through a LoadBalancer or NodePort that bypasses it.

Keep the admin APIs disabled. Prometheus disables them by default, the --web.enable-admin-api flag enables destructive operations, and --web.enable-lifecycle enables reload and shutdown endpoints. The Prometheus Operator passes these settings through the Prometheus resource, so review the spec for any extra arguments carried over from the VM unit file and remove them unless a named runbook needs them. For TLS, Prometheus supports TLS and client certificates with TLS 1.2 as the minimum. Basic authentication with bcrypt-hashed passwords is available, but without TLS it exposes credentials in cleartext, so do not enable it on a plain HTTP port. Plan certificate issuance and rotation for the Prometheus, Alertmanager and exporter endpoints before cutover.

The Prometheus Secrets, such as basic auth passwords, remote write credentials and Alertmanager receiver tokens, become Kubernetes Secrets. Kubernetes stores Secrets unencrypted in etcd by default, so confirm with your distribution whether encryption at rest is configured for Secrets, and plan it if not. Then restrict read access with least-privilege RBAC, since anyone who can list or watch Secrets in the monitoring namespace can read these credentials. Where your organization already runs a secrets manager, consider the Secrets Store CSI Driver so credentials are not stored in etcd at all. The Kubernetes Secrets good practices page sets out these options.

How DeployOpen scopes and delivers this migration

DeployOpen approaches moving Prometheus from VMs to Kubernetes with the Prometheus Operator as a planned, fixed-scope migration in infrastructure you control. We start by inventorying what the current VM-based Prometheus and Alertmanager actually do, then build the Operator-based setup in parallel, verify it, and cut alerting over only when both sides agree.

How we scope

  • We inventory every scrape job, rule file, Alertmanager receiver and dashboard that depends on the existing VM Prometheus.
  • We map each static target to a ServiceMonitor, PodMonitor or ScrapeConfig resource and record anything that does not translate cleanly.
  • We agree the scope, deliverables and timeline in writing before any cluster or configuration work begins.

How we build

  • We deploy the Operator-managed Prometheus and Alertmanager on your Kubernetes cluster with the TLS, authentication and admin API settings your security team specifies.
  • We convert alert rules into PrometheusRule resources and test each one against replayed or live data before it can page anyone.
  • We plan history retention and the cutover sequence so the old and new Prometheus can run side by side with no gap in alerting.

How we hand over

  • You receive the manifests, Helm values or configuration as code, along with a record of every mapping decision and its owner.
  • We document the cutover runbook, rollback steps, and the checks used to confirm that scrape targets and alert routes match the old system.
  • We walk your platform and on-call teams through daily operation, upgrades and how to add a new scrape target to the Operator setup.

How we support

  • Support after handover is available as a retainer that covers upgrades, configuration changes and periodic review of targets and rules.
  • Retainers can include planned version upgrades, so Prometheus and Operator releases are tracked against the support windows you choose.
  • Ongoing testing of the alerting path can be added so that a broken route or silenced receiver is found before an incident.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.