How Thanos extends existing Prometheus servers for global queries
If you run several Prometheus servers, or an HA pair, you probably have two problems at once: local retention is limited, and no single place answers a question across all of them. Thanos is added on top of Prometheus servers you already run, so you do not replace them. It reuses the Prometheus storage format to keep historical data in object storage and gives you one query view over every connected server. The core components are the Sidecar, which sits next to each Prometheus and uploads its blocks; the Querier, which fans queries out across sources and merges results; the Store Gateway, which serves historical blocks from object storage; and the Compactor, which manages retention and downsampling. Thanos is licensed under Apache-2.0, and according to its README, object storage is its only optional dependency. Your Prometheus servers still scrape and alert as before.
Two other pieces matter for planning. Thanos Receive is the push path: it implements the Prometheus Remote Write API for setups where Prometheus sends samples to Thanos instead of being read by it, so choose it only if your topology needs push. The Prometheus Operator can manage the Thanos sidecar through the Prometheus custom resource and Thanos Ruler through the ThanosRuler resource, while the Querier, Store Gateway, Compactor and Receive are deployed separately. Before you commit, confirm which of these your platform team will run, where the object storage bucket lives, and who owns the Compactor, since the Thanos compactor documentation says it must run as a singleton against each bucket.
The practical decision is how much of this your estate needs. The Thanos quick tutorial recommends keeping Prometheus in the same failure domain as the services it monitors, using persistent disk, and not scaling out Prometheus unless necessary. Thanos adds moving parts, so an estate with one server and short retention may not gain enough to justify it. Ask your partner or your team to write down the query and retention requirements first, then check that each Prometheus has the persistent storage and the block upload settings Thanos depends on before the rollout starts.
What you need before adding Thanos to Prometheus
Thanos sits on top of Prometheus servers you already run, so the starting point is a working, persistent Prometheus layout rather than new infrastructure. The cards below cover the Prometheus baseline, the object storage and Operator choices, the network paths Thanos needs, and the version pinning that keeps the stack supportable.
Prometheus v2.2.1 or later
Thanos requires one or more Prometheus installations at v2.2.1 or later, each with a persistent disk. Confirm every server runs that version or newer and that its TSDB directory survives restarts and node replacement. The sidecar reads blocks from that disk, so ephemeral storage will lose data before Thanos can upload it. Check the disk capacity against your retention before adding the sidecar.
Getting started guideObject storage access
Object storage is the only optional dependency in the Thanos design, but a long-term store needs one. Confirm you have a bucket, credentials that allow writes from sidecars and reads from the Store Gateway, and a retention policy agreed with the owner of the storage. Ask who pays for storage and egress, and who owns lifecycle rules, since these drive recurring cost more than the software does.
Distributed layout, not a single node
The Thanos getting started guide says Thanos is built to run as a distributed system and is not recommended for production on a single node. Plan separate hosts or pods for the Querier, Store Gateway, Compactor and each Prometheus, so one failure does not remove every component. Decide early where each component runs, since the Compactor must run as a singleton per bucket.
Network paths between components
The Querier must reach every sidecar and Store Gateway over gRPC, and the Store Gateway must reach the bucket. Map these paths before deployment, including any firewall rules, service discovery and TLS between components. Confirm that sidecars can be reached from the Querier without exposing Prometheus web endpoints to other networks, because the Prometheus security model says admin and lifecycle endpoints need protection.
Failure domain alignment
The Thanos tutorial recommends keeping Prometheus in the same failure domain as the services it monitors. A Prometheus in another zone or network may stay up while the services it watches are down, or the reverse, which produces misleading alerts. Record which failure domain each Prometheus belongs to and avoid scaling Prometheus out unless a single server can no longer keep up.
Quick tutorialOperator and version pinning
If you use the Prometheus Operator, it can manage the Thanos sidecar through the Prometheus resource and Thanos Ruler through the ThanosRuler resource, while the Querier, Compactor and Store Gateway are deployed separately. Confirm the Thanos version you will pin against the releases page before writing manifests. The latest releases supplied for this topic are v0.42.0 and v0.42.4, so check the release notes for whatever version is current when you start.
Thanos releasesConfiguration sequence for the Thanos sidecar, Querier and storage
This sequence turns existing Prometheus servers into a Thanos setup in which blocks are uploaded to object storage, a Querier serves a single view across HA replicas, and the store gateway and compactor keep long-term data queryable and downsampled.
Confirm Prometheus and storage prerequisites
The platform team checks that each Prometheus server runs a version compatible with Thanos (the getting started guide requires v2.2.1 or later), has persistent disk, and that an object storage bucket is available in infrastructure you control. Confirm the bucket, access policy and encryption requirements with your storage team before any configuration changes. The step is done when each Prometheus reports its version, its data directory sits on persistent storage, and the bucket accepts a test write from the account the sidecar will use.
Disable local compaction on each Prometheus
On every Prometheus server, set the min and max block duration to the same value in the Prometheus configuration. Equal values stop Prometheus from compacting blocks locally, which the Thanos sidecar documentation says is required because otherwise uploaded data can be corrupted. The check is a configuration review showing both settings are equal on every replica, followed by a restart and a log review confirming Prometheus started without errors.
Add the sidecar beside each Prometheus
Run a Thanos sidecar in the same pod, host or network namespace as each Prometheus instance, pointing it at the Prometheus data directory and API. Give the sidecar the object storage configuration file, and keep the sidecar in the same failure domain as its Prometheus. The sidecar serves the Store API on top of the Prometheus remote-read API, so the check is that the sidecar's gRPC endpoint responds and that its logs show it can reach Prometheus.
Confirm block uploads reach the bucket
Wait for Prometheus to close its first two-hour block, which the sidecar uploads as it is produced, then list the bucket. Each replica should write its own blocks with external labels that identify it, so blocks from different HA replicas can be told apart. The step is done when the bucket shows new block directories for every replica and the sidecar logs show successful uploads without repeated errors.
Deploy the store gateway for historical blocks
Deploy the Thanos store gateway against the same bucket so historical blocks uploaded by the sidecars can be queried after Prometheus no longer holds them locally. Store gateways need local cache space and read access to the bucket, so size the cache and grant read-only permissions. The check is that the store gateway reports its loaded blocks as ready and that a query for a time range older than local Prometheus retention returns data.
Deploy the Querier and set deduplication
Deploy the Querier and point it at every sidecar and store gateway endpoint, then set the replica label that the HA pairs use so the Querier merges and deduplicates the copies. Without deduplication, a query against an HA pair returns duplicate series. The check is a query for a metric scraped by both replicas that returns one series per target, and a second check that series from each replica appear when the replica label is removed from the query path.
Run the compactor as a singleton per bucket
Deploy the Thanos compactor against the bucket, making sure only one compactor instance runs for each bucket because the compactor must be a singleton. It downsamples raw data older than 40 hours to 5-minute resolution, and 5-minute data older than 10 days to 1-hour resolution. Confirm the compactor's scheduled jobs complete, that downsampled blocks appear in the bucket, and that a long-range query returns the expected resolution.
Document the sequence and set alerts on the stack
Record each component's version, configuration, external labels, bucket name and compactor placement in your runbook, and add alerts for failed sidecar uploads, store gateway load failures and compactor job failures. Have the platform team and your compliance owner review who can read and delete bucket contents. The step is done when a test alert fires from a deliberately stopped sidecar and the runbook has been walked through by someone other than the author.
How sidecars, Querier, store gateway and compactor connect
The diagram starts at two Prometheus HA pairs, each server running a Thanos sidecar that exposes the Store API and uploads its TSDB blocks to object storage every two hours. The Querier fans out to the sidecars for recent data and to the store gateway for historical blocks, then merges and deduplicates the HA pair series. The compactor runs as a singleton against the bucket to downsample old data. Check that each Prometheus has its min and max block duration set equal, and that only the Querier endpoint faces users.
Sidecars, Querier, store gateway and compactor around one bucket.
Deploying Thanos with the Prometheus Operator or by hand
The Prometheus Operator can add the Thanos sidecar to a Prometheus custom resource and can deploy Thanos Ruler through the ThanosRuler resource. In this path the Operator generates the sidecar container, wires it to the Prometheus pods and keeps the sidecar version and configuration in step with the Prometheus resource, so you describe the desired state in Kubernetes objects instead of editing container arguments by hand.
- Sidecar placement: the Operator adds the sidecar to each Prometheus pod, which keeps the sidecar lifecycle tied to the Prometheus replica it serves.
- Object storage configuration: you reference a Kubernetes secret that holds the bucket settings, so credentials stay out of the main configuration.
- Block duration settings: confirm the Operator applies equal minimum and maximum block durations when the sidecar uploads blocks, since unequal values can corrupt uploaded data.
- Ruler scope: ThanosRuler evaluates rules against the global query layer, so rule ownership moves from each Prometheus server to a separate resource.
- Operator version pinning: the Operator and the Thanos image it deploys must match the Prometheus versions you run, so track both in your upgrade plan.
Before relying on the Operator path, check the Operator documentation for the Thanos fields your release supports and test the sidecar upload on a non-production cluster.
The Operator does not deploy the Querier, Receive, Compactor or Store Gateway. These components run as their own workloads in both paths, so the Operator reduces the sidecar and ruler work but leaves most of the Thanos topology to your team. Each one has its own replicas, resource limits, storage needs and upgrade cycle.
- Querier: you deploy it, point it at each sidecar and Store Gateway endpoint, and define how HA pairs are deduplicated.
- Receive: only needed if Prometheus pushes through remote write, and you manage its tenant headers and replication settings.
- Compactor: you run it as a singleton against each object storage bucket, so it must never be scaled out or run twice.
- Store Gateway: you size its cache and memory for the volume of historical blocks you query.
- Object storage: the bucket, its lifecycle rules and its access policies remain your responsibility under either path.
Ask any partner to show the deployment manifests or Helm values for these four components, not only the sidecar configuration, because that is where most of the ongoing work sits.
A manual deployment runs the sidecar as a container you add to each Prometheus host or pod, with its own flags for the Prometheus data directory, object storage configuration and gRPC listener. This path suits teams that run Prometheus on virtual machines, bare metal or Kubernetes without the Operator, and it gives full control over each flag and file path.
- Sidecar configuration: you write the object storage file, set the data path and manage the sidecar's gRPC endpoint and TLS settings.
- Prometheus settings: you set the equal minimum and maximum block durations in the Prometheus configuration and keep them that way through every restart.
- Service discovery of endpoints: you register each sidecar and Store Gateway with the Querier, usually through static addresses or a discovery mechanism you maintain.
- Process supervision: you own restarts, upgrades and resource limits for every Thanos process.
- Configuration drift: every host or pod is configured separately, so changes need a repeatable method such as configuration management or templates.
Before you choose this path, confirm your team can run and upgrade each Thanos process on the same schedule as Prometheus.
The two paths split the work differently, but the operating responsibilities for the wider system stay with your team. Use this tab as a checklist when you compare internal and partner estimates, because the Operator path reduces sidecar configuration while the manual path adds it back.
- Operator path: your team owns the Kubernetes manifests, the Operator upgrades, the Querier, Receive, Compactor and Store Gateway deployments, and the bucket.
- Manual path: your team owns every sidecar, Prometheus configuration file, process supervisor, the same four separate components and the bucket.
- Access and secrets: both paths need object storage credentials, TLS between components and a plan for rotating them.
- Monitoring Thanos itself: you need alerts on compaction lag, upload failures and Querier errors in either path.
- Recovery: test restoring Prometheus data and rebuilding the Store Gateway index from the bucket, since the bucket is the long-term record.
When you request a quote, ask for the scope to list each component by path and by owner, so the cost comparison reflects the same work.
Which Prometheus and Thanos settings map to which data
This table connects the Prometheus and Thanos settings you will choose to the data behavior they control, such as deduplication, retention, global queries and upload timing. Read each row as a question: if you change this setting, what changes in what the Querier returns or what object storage keeps? The main takeaway is that external labels and block duration settings must be decided before the first upload, because they are hard to correct afterward.
| Setting or component | What it controls | What to decide or confirm |
|---|---|---|
| External labels on each Prometheus | Identify which server or cluster produced each series in the Querier and object storage | Use one agreed naming scheme across all clusters, such as cluster and region labels, and document it before the first sidecar starts |
| Replica label on HA pairs | Tells the Querier which series come from duplicate Prometheus replicas so it can merge them | Give each replica of a pair a distinct value for the same label, and confirm the Querier is set to deduplicate on that label |
| Sidecar Store API | Exposes local Prometheus data and recent blocks to the Querier through the Store API on top of remote read | Register each sidecar endpoint with the Querier so it can fan out queries; confirm which sidecars are reachable from the Querier network |
| Object storage bucket | Holds uploaded TSDB blocks and downsampled data that define long-term retention | Use one bucket per Thanos deployment; confirm retention per resolution with the Compactor settings and your data policy |
| Min and max block duration | Keeps Prometheus from compacting local blocks, so sidecar uploads stay intact and consistent | Set min and max block duration to equal values when the sidecar uploads blocks, as the Thanos sidecar docs require |
| Compactor singleton | Downsamples raw data after 40 hours to 5-minute resolution and 5-minute data after 10 days to 1-hour resolution | Run exactly one Compactor per bucket and confirm the downsampling windows match your retention and query needs |
| Receive tenant header | Maps incoming remote write traffic to a tenant using the THANOS-TENANT header by default | Agree on tenant names with each sending team, and confirm senders set the header consistently before enabling Receive |
Securing the Thanos endpoints and object storage
Thanos adds several network-facing components and a bucket of historical metrics to an estate that was previously a set of single Prometheus servers. The cards below cover the controls that connect them: transport encryption, authentication in front of the UI and Querier, scoped storage access, disabled admin APIs and tenant separation for Receive. Each one is a decision to make and verify before the Querier is shared with other teams.
TLS and client certificates
Prometheus supports TLS and client certificate authentication, with TLS 1.2 as the minimum version, so the sidecar, Querier and Store Gateway endpoints can be encrypted and restricted to known callers. Decide which components present client certificates to each other and who issues them. Check the TLS settings on every listener, not only the one users reach through the browser. Ask your security team to confirm the certificate lifecycle, including rotation and revocation, before go-live.
Prometheus security modelBasic authentication requires TLS
Prometheus supports HTTP basic authentication with bcrypt-hashed passwords, but without TLS the credentials travel in cleartext on the wire. Any sidecar, Querier or proxy path that uses basic auth must sit behind TLS end to end, including traffic between internal components. Treat this as a hard rule in the design review rather than a hardening option. Confirm that no internal hop falls back to plain HTTP during testing.
SSO through an authenticating proxy
Prometheus has no built-in single sign-on, and its security model notes there is no built-in CSRF protection on mutating endpoints. Place an authenticating reverse proxy in front of the Querier UI and API so that users sign in through your identity provider. The proxy then becomes a control point for session lifetime, group mapping and logging. Confirm that direct access to the Querier port is blocked so the proxy cannot be bypassed.
Scoped object storage access
The sidecar, Compactor and Store Gateway each need access to the object storage bucket, but they do not need the same permissions. Create separate credentials per component, limit them to the bucket and prefixes they use, and avoid sharing an administrative key across the stack. The Compactor must run as a singleton against each bucket, so restrict who can start a second instance. Ask the storage team to confirm how keys are rotated and where they are stored.
Thanos Compactor docsKeep admin APIs disabled
Prometheus admin HTTP APIs are disabled by default. The --web.enable-admin-api flag enables destructive operations such as deleting series, and --web.enable-lifecycle enables reload and shutdown endpoints. Leave both off on every Prometheus server in the Thanos stack unless a documented runbook needs them, and restrict them to a named operator role when they are turned on. Verify the setting in the running process rather than trusting the deployment file alone.
Tenant isolation for Receive
Thanos Receive accepts pushed samples through the Prometheus Remote Write API and identifies tenants by the THANOS-TENANT header by default. Tenant identity is only as strong as the layer that sets that header, so the Receive endpoint must authenticate senders or sit behind a gateway that stamps the header itself. Agree on tenant naming and reject unknown tenants. Test that one tenant cannot write to or query another tenant's series.
Thanos Receive docsCommon Thanos failures and how to fix them
This table lists the failures teams most often hit when adding Thanos to existing Prometheus servers, with the cause and fix for each. Read it before the first upload to object storage, and again when queries look wrong or the bucket stops compacting.
| Failure | Cause | Fix |
|---|---|---|
| Corrupted uploaded blocks | Prometheus min and max block duration are not equal, so local compaction runs and changes blocks the sidecar has already uploaded | Set min and max block duration to the same value on every Prometheus that runs the sidecar, then check the uploaded blocks |
| Duplicate series across HA pairs | Two Prometheus replicas scrape the same targets without distinguishing external labels, so the Querier sees two copies of each series | Give each replica a unique replica label, then configure the Querier to deduplicate on that label |
| Two compactors on one bucket | A second Compactor is started against the same object storage bucket, so compaction and downsampling jobs collide | Run exactly one Compactor per bucket and use scheduling or a single-replica workload to enforce it |
| Slow long-range queries | The Store Gateway has no index or block caching, so it reads from object storage on every query over older data | Size and configure caching for the Store Gateway, and narrow dashboard time ranges where the data does not need full resolution |
| Gaps from unreachable sidecars | A sidecar cannot reach its Prometheus, or the Querier cannot reach the sidecar, so that source drops out of global results | Monitor sidecar and Querier endpoints, fix network paths and service discovery, and alert when a store endpoint goes down |
| Missing downsampled data | The Compactor has not caught up, or raw data is queried at a resolution that has not been produced yet | Check Compactor progress and confirm the retention and downsampling windows match what dashboards expect |
Questions buyers ask before adding Thanos
What drives the cost of running Thanos?
Cost comes from three places: compute and disk for the Prometheus servers and Thanos components, object storage for historical blocks, and the people who build and run the stack. Thanos itself is licensed under Apache-2.0, so there is no license fee for the software. The biggest variables are how many active series you ingest, how long you retain data, how many query paths hit the Querier, and how often you need to re-run the Compactor and Store Gateway against large buckets. Ask any quote to separate one-time build effort from recurring infrastructure and operating effort, and to state which object storage tier and retention period it assumes.
Can our own team set up Thanos without a partner?
Yes, many teams do, provided they already run Prometheus reliably and have someone who can operate object storage, certificates and Kubernetes or VM tooling. The Thanos getting started guide describes it as a distributed system that is not recommended for production on a single node, so plan for several components rather than one binary. Consider the skills needed for sidecar configuration, deduplication across HA pairs, the singleton Compactor per bucket and downsampling settings. A partner is useful when those skills are missing or the work must finish inside a fixed window.
How long does a Thanos rollout take, and what changes the timeline?
No supplied figure gives a standard duration, so ask for one based on your environment. The main factors are how many Prometheus servers and HA pairs exist, whether they run on Kubernetes with the Prometheus Operator, how object storage access and encryption policies are approved, how many dashboards and alert rules depend on current query endpoints, and how much query testing your team requires before cutover. Ask the vendor to list each milestone and the environments it covers, and to state what happens if a dependency such as storage access is late.
What do we need to provide before work starts?
Expect to provide at least one or more Prometheus v2.2.1 or later installations with persistent disk, as the Thanos getting started guide requires, plus a target object storage bucket and credentials. You will also need network paths between the Querier and sidecars, identity and TLS decisions, and access to the Grafana or other query clients that will change data sources. Provide a list of existing recording and alerting rules, retention requirements, and the people who approve changes. The Prometheus Operator can manage the sidecar and ThanosRuler if you already use it.
Is Thanos the right choice compared with remote write to Mimir or VictoriaMetrics?
It depends on whether you want to keep Prometheus as the storage and query owner or move long-term storage to a separate system. Thanos adds a sidecar next to each existing Prometheus and keeps historical data in object storage, which suits teams that want to keep their current servers and gain a global view. Remote write to Mimir or VictoriaMetrics sends samples to a central store, which can simplify deduplication and multi-tenancy but adds a new cluster to run. Compare operating effort, licensing and features such as tenancy with each vendor, and confirm which edition offers the capabilities you need.
Does Thanos fix the single-server limits of Prometheus?
Not by itself. The Thanos tutorial recommends keeping Prometheus in the same failure domain as the services it monitors, using persistent disks, and avoiding scale-out unless it is needed. Thanos adds global queries, deduplication of HA pairs and object storage retention, but each Prometheus still ingests and scrapes its own targets. If one server cannot keep up, sharding or remote write tuning may still be required. Ask for an assessment of current ingestion and memory use before deciding which problem Thanos solves for you.
What should we verify before going live with Thanos?
Verify that the sidecar uploads blocks as expected, that Prometheus min and max block duration are set to equal values to disable local compaction (otherwise uploaded data can be corrupted, per the sidecar docs), that the Querier deduplicates HA pairs correctly, and that only one Compactor runs against each bucket. Test a dashboard and an alert rule that query data older than local retention, and confirm downsampling behaves as the compactor docs describe. Also test access controls on the query endpoints and object storage, because Thanos adds network surfaces that need hardening.
How DeployOpen scopes and delivers a Thanos integration
DeployOpen plans and builds Thanos on top of the Prometheus servers you already run, inside your own cloud accounts, data centers or air-gapped networks. Each engagement starts with a written scope covering the sidecar, Querier, Store Gateway and Compactor, so your team knows what is delivered before work begins.
How we scope
- Inventory existing Prometheus servers, HA pairs, retention settings and the object storage bucket you plan to use.
- Confirm which Thanos components are in scope, such as Sidecar, Querier, Store Gateway and Compactor, and where each runs.
- Agree in writing how global queries, deduplication, downsampling and retention will be verified before the build starts.
How we build
- Configure sidecars next to each Prometheus server, with min and max block duration set to equal values to disable local compaction.
- Deploy the Querier across HA pairs with external labels, then confirm deduplication merges replica series as designed.
- Run the Compactor as a single instance per bucket, then test downsampling of raw data and retention policies against your settings.
How we hand over
- Deliver configuration as code, runbooks for upgrades, bucket lifecycle rules and access controls, plus documented architecture decisions.
- Walk your platform and monitoring teams through alert rules that watch sidecar uploads, compaction status and query health.
- Provide test evidence from the verification plan so your compliance and security reviewers can check what was built.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer after handover, scoped in writing.
- Retainers can cover Thanos version upgrades, tracking Prometheus release lines and reviewing object storage cost and retention.
- Ask us to confirm in the quote which support hours, response expectations and upgrade tasks are included before signing.

