Setting Up Infrastructure Monitoring with Prometheus

When a cluster grows, homegrown monitoring starts lagging: alerts arrive after an incident has already occurred. We set up Prometheus in Kubernetes turnkey — from metric collection to runbooks for your team. Failure detection time drops severalfold, and false positives go away.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1365
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

Why Prometheus configuration in Kubernetes breaks as load grows

While there are a dozen services in a cluster, infrastructure monitoring seems like a task solved once: Prometheus discovers targets, metrics are written, alerts arrive.

Growth changes the picture — the number of targets and time series grows faster than the scrape interval and retention depth can keep up. A Prometheus configuration in Kubernetes assembled for the current scale falls apart at the very next step.

The first bottleneck in metric collection is dropped targets. After a restart, pods get new addresses, some of them drop out of scraping, and gaps appear on dashboards instead of numbers.

The second is storage overflow: old data is evicted according to retention, while labels such as pod name, namespace, request path, and response code cause explosive growth in the number of time series. Historical queries slow down exactly when the data is needed for troubleshooting.

The third is alert noise. One failed node generates hundreds of firings across dependent services, the on-call engineer stops reading notifications, and a real outage is lost among false ones.

Next to it are service failures without alerts: rules describe hardware state, but not queues, external dependency errors, and response time growth. The team learns about such a failure from users — that is, later than it began, and without data on exactly where.

All these areas are connected: as long as targets are discovered automatically, alerts are grouped meaningfully, and retention depth and label count are limited deliberately, metric collection remains predictable.

Below we break down how this is addressed — from target discovery to rules by which the on-call engineer immediately understands where to go.

What managed monitoring delivers: faster response and less downtime

Managed monitoring starts with metrics being collected from all layers — nodes, containers, applications, and load balancers — and converging into one system with a single query language.

In Prometheus, this is a set of collection agents, recording rules, and a predictable label schema by which any slice can be cut. Cluster observability is not a dashboard of graphs for the on-call engineer, but a loop where degradation is visible before the user feels it.

Failure detection time drops from "the customer wrote to support" to an automatic alert with the exact object: node, container, external dependency.

Alerts are formulated by symptoms, not by cause — not "high load", but "the share of error responses stays above threshold for longer than five minutes".

This removes noise and leaves signals by which the on-call engineer immediately opens the needed instruction.

Failure classes caught before the user: memory leaks in containers, resource exhaustion on nodes, degradation of disk operations, stuck queues, expiring certificates, replica desynchronization. Each has a precursor metric, and the firing threshold is built from it.

Downtime cost is determined not only by duration, but also by the volume of operations that stopped along with the service.

When the window between the first metric deviation and the start of recovery shrinks to minutes, some incidents are closed in a planned mode — without firefighting and manual log sifting.

Ways to collect metrics in Kubernetes: agent, operator, external collection

Metric collection in Kubernetes rarely fits into one scheme: indicators come from nodes, containers, and external systems.

Whether an agent on each node, an operator inside the cluster, or external collection is chosen affects the amount of manual work for every service update and the predictability of metric storage.

Schemes and their limits

Option When it fits Limitations
Agent on each node Small environment with a stable set of services, node and container metrics needed Targets are described manually; frequent changes cause gaps and duplicate series
Operator in the cluster Cluster with frequent updates, target auto-discovery and unified labeling rules needed Targets live as separate objects; cluster upgrades require monitoring compatibility of descriptions
External collection Multiple clusters, isolated networks, one storage point for all environments Depends on network availability and permissions; a delay appears between an event and the metric

Metric storage is chosen by the same principle: local storage with a limited term keeps recent history and responds quickly to queries; external storage keeps long series for post-mortem incident analysis.

In practice, schemes are combined: the operator handles target auto-discovery inside the cluster, and remote write offloads series to external storage — this way Prometheus stops hitting the local disk size limit.

Monitoring implementation stages: from audit to handover of procedures

Deploying Prometheus in a cluster takes a few hours. Difficulties begin later: metrics are collected but do not answer the question "what exactly degraded and who is going to fix it", alerts arrive in batches or stay silent about a real problem.

Therefore, the work follows a fixed sequence, where each stage builds on the previous one and ends with an artifact that can be verified.

  1. Monitoring audit. We inventory metric sources — nodes, cluster state, services — review inherited graphs and rules, and find blind spots: places where data exists but no one looks at it. The result is a gap map and a list of what is missing.
  2. Metric collection scheme. We define levels — infrastructure, applications, key business events — and granularity: scrape frequency, retention period, label composition. Extra labels inflate storage faster than the growth in the number of services.
  3. Building the environment. We bring up Prometheus in the cluster and connect automatic target discovery so that new pods are covered by collection without manual configuration edits. We separate environments, otherwise test spikes distort the production picture.
  4. Configuring alert rules. We write rules based on symptoms — unavailability, error growth, resource exhaustion — not on every rejected connection. We set up grouping and suppression of related signals, routing by on-call teams; each rule has an owner and a first-response procedure.
  5. Load testing. We send peak traffic and take turns failing a node, storage, and the network to a service. We check whether the alert fired within the expected time, reached the right person, and did not wake half the team with a false alarm.
  6. Handover of procedures and on-call training. We hand over response descriptions, walk through a training alert step by step, and fix the escalation order. After that, the team changes thresholds and new rules itself.

Configurations, schemes, and procedures: what stays with your team

After implementation, the team is left not with a set of manually configured screens, but with a reproducible system: configurations are stored in a repository, changes are reviewed, and deployment is repeatable in any environment. Below is a list of artifacts handed over together with a working monitoring environment.

  • Configuration files. Declarative descriptions of metric collection, scrape targets, and recording rules — with revision history and change review before applying.
  • Data collection schemes. A scrape map: which nodes and services are monitored, at what interval, where agents are installed, and how environments differ.
  • Alert rules. Firing thresholds, grouping of related signals, duplicate suppression, and routing by owners — the on-call engineer receives one meaningful signal, not an avalanche.
  • Dashboards. Screens for each service: resource utilization, response latency, error rate, queue depth — broken down by environment and with a comparison period.
  • Access policies. Roles and permissions: who only views, who changes rules, who has access to sensitive data. Login via a single account, keys are not stored in plain text.
  • On-call procedures. Who is responsible during and outside working hours, escalation order, maintenance windows in which alerts are suppressed deliberately.
  • Instructions for typical firings. What to check first, where to look at graphs, how to roll back a change, and when to raise an incident.
  • Documentation. Metric retention periods, storage volume after cleanup, the procedure for adding a new service to monitoring — without contacting us.

Case study: failure detection time reduced, false alarms eliminated

A Kubernetes-managed cluster was maintained reactively: metrics were collected from some nodes, connected manually, and a new service could live without monitoring.

The on-call engineer learned about a failure from a user complaint — on average after half an hour, and more than half of notifications came from a single spike and were habitually ignored.

What was changed

Prometheus configuration in Kubernetes was deployed with automatic target discovery: the list is pulled from the cluster API, so new workloads are covered by collection without configuration edits.

Alert rules were rewritten — a critical event requires a sustained deviation over several windows, not a single measurement. Alertmanager handles routing: similar notifications are merged, related ones suppressed, and each has its own urgency level.

The outcome

On-call response time decreased from half an hour to three minutes — failures are caught before users report them. The share of false alarms fell from six cases out of ten to one out of twenty.

The volume of stored metrics decreased threefold over the same horizon: duplicate series were removed and a data lifecycle was defined instead of a "store everything" mode.

A separate benefit is incident analysis: the on-call engineer arrives to ready-made graphs and sees which dependency degraded first.

Monitoring itself is also under control: separate checks monitor the health of the collector, so silence in the channel is not mistaken for well-being.

What to do if monitoring is already deployed but alerts are useless

Deployed monitoring by itself means nothing: if the on-call engineer ignores alerts, the rules report not what is important, but what is convenient to measure.

A typical cause is checks attached to every available metric: unavailability of an individual process, memory consumption growth, single errors in the log. Some thresholds end up below natural load fluctuation, some duplicate each other, and the real signal drowns in noise.

We start with measurement: what share of firings was confirmed by a real incident, and what share was closed without action. It becomes clear which alerts arrive in batches within one minute and describe one event from different sides. This gives a list of rules that can be removed without losing sensitivity.

Rebuilding alert rules starts not from metrics, but from symptoms: a rule fires on what the user noticed — service unavailability, increased response time, data discrepancy. Internal metrics remain on graphs for analysis but stop waking people at night.

We add grouping of related signals and a confirmation delay so that a short spike does not turn into an on-call callout.

Configuration migration proceeds gradually and without service downtime: rules are moved to a repository, brought to a unified form, checked against historical data, and reviewed before enabling.

The new set works in parallel with the old one, and old rules are turned off one by one while it is clear that coverage has not dropped.

As a result, the on-call engineer receives a few alerts per shift instead of hundreds, and each requires a specific action. False alarms stop being background noise, and time to response decreases: the signal is visible immediately, not after going through the feed.

Technical doubts: load, data volume, false alarms

Before starting, the technical team asks the same questions: how many resources monitoring itself will consume, where metrics will be stored in six months, what to do with non-standard metrics, and whether it is really possible to deploy all this on a live cluster without service downtime. Below is how we address each point in practice.

What load does monitoring itself create?

Prometheus scrapes targets on a schedule, so consumption is predictable and depends on the number of targets and the scrape interval, not on application traffic.

Collection is done via node-exporter and kube-state-metrics, we set the interval to 15–30 seconds, and heavy queries are precomputed by rules — dashboards and alerts read ready-made series.

On a node, this is fractions of a percent of CPU time; database volume grows linearly and predictably.

How long should metrics be stored and what to do with old ones?

The hot window is 15–30 days: it is enough to analyze an incident and compare service behavior before and after a release.

After that, we do not delete the data but downsample it and move it to remote storage — detailed series remain available for analysis, and long trends are viewed using compressed points. Disk stops being a limitation, and history is preserved for years.

What if the metrics are non-standard?

For custom scenarios, we write exporters and collect data through a text collector; short-lived jobs return results upon completion.

Then come aggregation rules and labels: business indicators, queue depth, and response time of external systems land in the same dashboards and alerts as standard cluster metrics.

Can it be implemented without service downtime?

Yes. Monitoring is installed in a separate namespace and does not intercept traffic: exporters only read open metric endpoints.

Rollout is phased — first a test environment, then production, with verification after each step; configurations and rules are versioned, and rollback is one command. No scheduled maintenance on your services is required.

These four answers remove most questions before the start. The rest are details of a specific environment: we go through them at the assessment stage.

Let's discuss the task: a monitoring implementation plan for your cluster

Task assessment is based not on a questionnaire, but on data from your environment: how many clusters and nodes, which services are critical for the business, what is already collected today, and what depth of metric history is needed for incident analysis.

This determines both the scope of work and the order of enabling metric collection in the production environment without service downtime.

Below is what will be needed from your side and what will be included in the monitoring implementation plan.

  • Access: read-only to the cluster, permissions for a separate namespace for the monitoring system, agreed change windows.
  • Inventory: list of services and nodes, critical metrics, firing thresholds, on-call owners.
  • Monitoring implementation plan: stages, order of connecting collection targets, readiness criteria for each stage.
  • Scope of work: deployment and configuration of metric collection, alerting rules, dashboards, integration with notification channels.
  • Task assessment: timelines by stage, storage resource requirements, risks — growth in metric cardinality and history volume.
  • Monitoring support: analysis of false alarms, updating rules for new services, incident response procedure.
  • Handover: runbook for typical failures, configuration documentation, on-call shift training.

Describe the task and send your current environment diagram — we will come back with an estimate of timelines and a stage-by-stage plan.