OneStopList

Gods and goddesses

Prometheus Zero Configuration Setup Explained

Updated November 25, 2026

Prometheus does not have a true zero-configuration setup; you must at minimum define scrape targets in a configuration file, but you can start monitoring a single host in under five minutes with a minimal three-line config and a default binary. The term “zero configuration” usually refers to service discovery integrations (like Kubernetes or EC2) that automatically populate scrape targets, not to running Prometheus with no config at all.

What Prometheus Actually Requires

Prometheus is a pull-based monitoring system: it scrapes HTTP endpoints that expose metrics in a plain-text format. Even the simplest deployment needs a prometheus.yml file that tells the server what to scrape and how often. The absolute minimum config looks like this:

global:
  scrape_interval: 15s
scrape_configs:
  - job_name: 'node'
    static_configs:
      - targets: ['localhost:9100']

That file, plus the Prometheus binary and a metrics exporter (like the Node Exporter for system metrics), is enough to start collecting data. There is no database to initialize, no schema to create, and no user accounts to set up. Prometheus stores everything in its own local time-series database automatically.

How the Default Setup Works

When you download the official Prometheus release, it includes a default prometheus.yml that scrapes Prometheus itself. That is why the web UI shows metrics immediately after you run ./prometheus with no flags. The built-in job prometheus targets localhost:9090 and gives you a working example of a scrape target. You can replace that job with your own targets and restart the process.

Prometheus also ships with a set of default recording rules and alerting rules in the rules subdirectory, but those are optional. The server runs with a default retention of 15 days for metrics, which you can change with the --storage.tsdb.retention.time flag.

Service Discovery: The Real “Zero Config”

In dynamic environments, manually listing every target in a static config becomes impossible. Prometheus solves that with service discovery integrations. When you enable Kubernetes SD, for example, Prometheus automatically finds all pods and services that match your selectors and starts scraping them without any further edits. The same applies to EC2, Consul, DNS, and dozens of other providers. This is the closest thing to zero configuration: you write one config block that defines a discovery mechanism, and the target list updates itself.

For example, a Kubernetes SD config might look like:

scrape_configs:
  - job_name: 'kubernetes-pods'
    kubernetes_sd_configs:
      - role: pod
    relabel_configs:
      - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
        action: keep
        regex: true

Here, any pod with the annotation prometheus.io/scrape: "true" is automatically scraped. You never touch the config again when adding or removing pods.

Common Misconception: Zero Config Means No Config

Many tutorials and blog posts use “zero configuration” loosely to mean “easy to get started” rather than literally no config. Prometheus always requires a config file, even if it is minimal. The confusion often comes from tools like Prometheus Operator or Helm charts that generate the config for you. With those, you provide high-level settings (like which services to monitor) and the operator writes the actual prometheus.yml. From the user’s perspective, it feels like zero config because you never edit the raw YAML.

Another related misconception is that Prometheus can automatically detect every service on your network without any setup. It cannot. You must either list targets statically or configure a discovery mechanism. Even the default self-scrape is an explicit config entry.

How to Choose Between Static and Dynamic Setup

For a single server or a small lab, static configs are simplest. You write a few lines, run Prometheus, and you are done. For a production cluster with dozens of instances that change frequently, service discovery is essential. The trade-off is complexity: SD configs often require relabeling rules to filter and map metadata, which has a learning curve.

Consider these factors when deciding:

  • Number of targets: under 10, static is fine; over 50, SD saves time.
  • Target churn: if instances come and go, SD avoids constant edits.
  • Infrastructure type: Kubernetes, EC2, and Consul have native integrations.
  • Team skill: static configs are easier to debug and reason about.

Setting Up a Minimal Monitoring Stack

To get a working Prometheus monitoring a real machine, follow these steps:

  1. Download the latest Prometheus release for your OS from the official site.
  2. Extract the archive and navigate into the directory.
  3. Create a prometheus.yml with the minimal config above, replacing localhost:9100 with your target.
  4. Download and run the Node Exporter on the same or a different host, listening on port 9100.
  5. Start Prometheus with ./prometheus --config.file=prometheus.yml.
  6. Open http://localhost:9090 and query up to see the target’s health.

That is the entire setup. No external database, no authentication, no additional services. Prometheus will start scraping immediately and store data in the data directory.

Alternatives and Comparisons

If you want a monitoring system with even less setup, consider hosted services like Grafana Cloud or managed Prometheus offerings (AWS, Google, Azure). They handle the server side entirely; you only install an agent that pushes metrics. This is true zero-config from your perspective because you never run a Prometheus server.

Another alternative is VictoriaMetrics or Thanos, which are compatible with Prometheus configs but offer different storage and scaling features. They still require the same basic config format. For a quick start, some people use Prometheus in Docker with a pre-built image and a mounted config, which is essentially the same as running the binary.

Frequently Asked Questions

Can I run Prometheus without any config file? No. Prometheus refuses to start without a config file. The default config that ships with the binary is a real file, not an internal default. You can run it as-is, but it only scrapes Prometheus itself.

What is the easiest way to monitor a Docker container? Use the cAdvisor exporter or the Prometheus Docker SD. With Docker SD, you add a config block that discovers containers and scrapes them automatically. You still need to run cAdvisor or expose metrics from your app.

Does Prometheus auto-detect services on my network? No. It only scrapes what you list or what your service discovery mechanism returns. There is no network scanning or automatic detection.

How do I add a new target without restarting Prometheus? Prometheus reads the config file at startup only, so you must restart or send a SIGHUP signal to reload. Alternatively, use service discovery so targets update dynamically without restarts.

Is Prometheus zero-config for Kubernetes? Not out of the box. You need to enable Kubernetes SD in your config and typically add relabeling rules. The Prometheus Operator simplifies this but still requires installing the operator and defining a ServiceMonitor resource.

Related

How pages are sourced and corrected: Sources and editorial policy.