Most Kubernetes teams deploy Prometheus with a guessed PersistentVolumeClaim (PVC) size—usually 20 GiB or 50 GiB—and forget about it until an alert fires at 3:00 AM: PrometheusTSDBCompactionsFailing or DiskPressure on the node.
There are three reasons static guesses break down quickly in Kubernetes:
Dynamic Pod Churn: Every rolling deployment, HorizontalPodAutoscaler (HPA) event, or CronJob creates new
podandcontainerlabel combinations, spiking active time series.Write-Ahead Log (WAL) & Compaction Headroom: Prometheus does not simply append flat files. During 2-hour block compactions, it temporarily writes new merged blocks before deleting old ones, requiring 20%–30% extra free disk space.
Unbounded Retention: Setting
--storage.tsdb.retention.time=30dwithout a size cap means a single high-cardinality label leak (such as puttingrequest_idoruser_idinto a metric) can fill your entire PVC in hours.
How Prometheus TSDB Stores Data on Disk
Understanding the write path explains why both RAM and Disk grow together:
Scrape Targets: Prometheus pulls metrics from Kubernetes Pods, nodes (
node_exporter), andkube-state-metricsat eachscrape_interval(commonly15sor30s).In-Memory Head Block & WAL: Incoming samples are held in memory (the Head block) for fast querying and simultaneously written sequentially to the Write-Ahead Log (WAL) on disk so data survives restarts.
Compaction: Every 2 hours, the Head block is flushed to disk as an immutable 2-hour block. Over time, background compaction merges smaller blocks into larger 12-hour, 24-hour, and multi-day blocks.
Persistent Disk (PVC): Older blocks are deleted once they exceed either
retention.timeorretention.size.
The Core Prometheus Storage Sizing Formula
In Prometheus TSDB, each sample typically compresses down to 1 to 2 bytes on disk (with ~1.5 bytes being a reliable production baseline for Gorilla/XOR compression).
needed_disk_space = retention_time_seconds × ingested_samples_per_second × bytes_per_sample
Where:
ingested_samples_per_second = active_time_series / scrape_interval_secondsretention_time_seconds = retention_days × 86400bytes_per_sample ≈ 1.5(use2.0if your metrics have high label churn or random float values)
Worked Example
Suppose your Kubernetes cluster has 200,000 active time series, a 15s scrape interval, and 30 days of retention:
Ingestion rate:
200,000 / 15 = 13,333 samples/secRaw TSDB data (at 1.5 bytes/sample):
30 × 86,400 × 13,333 × 1.5 ≈ 51.84 GBAdd 30% headroom for WAL & Compaction:
51.84 GB × 1.30 ≈ 67.4 GB
In this scenario, a 50 GiB PVC will run out of space before day 30. You should provision at least an 80 GiB PVC and set --storage.tsdb.retention.size=65GB.
Interactive Tool: Quick Prometheus TSDB & PVC Estimator
Interactive Tool: Try the live interactive calculator directly in the original OpsHubs guide.
4 Practical Ways to Cut Prometheus Storage Costs by 50%+
1. Always Set Both retention.time and retention.size
Never rely on time alone. Add --storage.tsdb.retention.size set to 80%–85% of your PVC capacity so Prometheus evicts old blocks cleanly before hitting 100% disk full.
args:
- --storage.tsdb.retention.time=30d
- --storage.tsdb.retention.size=65GB
- --storage.tsdb.wal-compression
Enabling --storage.tsdb.wal-compression reduces WAL disk footprint by 30%–50% with negligible CPU overhead.
2. Drop Unused High-Cardinality Metrics at Scrape Time
In Kubernetes, kube-state-metrics and cAdvisor often generate over 60% of total series. Use metric_relabel_configs in your ServiceMonitor or prometheus.yml to drop unused histogram buckets or verbose container labels:
metric_relabel_configs:
- source_labels: [__name__]
regex: 'apiserver_request_duration_seconds_bucket|etcd_request_duration_seconds_bucket'
action: drop
3. Tune scrape_interval by Tier
Not every target needs 15s granularity:
Critical payment / API services:
15sNode & infrastructure exporters:
30sBatch jobs / non-prod namespaces:
60s
Moving non-critical targets from 15s to 30s immediately cuts their sample ingestion rate and disk usage in half.
4. Offload Long-Term Retention to Object Storage
Local NVMe/SSD PVCs are expensive for 90-day or 1-year compliance retention. Keep 7–15 days on local Prometheus PVC for fast alerting and recent debugging, and ship older blocks to S3-compatible object storage using Thanos or VictoriaMetrics.
Quick Production Checklist
Measure real active series via
prometheus_tsdb_head_seriesbefore sizing.Reserve 25%–30% PVC headroom above raw TSDB calculation for WAL + compaction.
Enable
--storage.tsdb.wal-compressionand--storage.tsdb.retention.size.Run our Prometheus Storage Calculator whenever onboarding a new cluster or microservice tier.
Pair this with proper pod memory sizing—check out our guides on Java OOMKilled in Kubernetes and our Kubernetes QoS Class Checker.
Originally published at OpsHubs. Found it useful? Buy us a coffee ☕.

Top comments (0)