Why teams require client certificates for Prometheus scrapes
Teams require client certificates for Prometheus scrapes when exporters sit on networks where other hosts, containers or tenants can reach their HTTP endpoints. Node-style exporters often expose metrics that reveal hostnames, software versions, queue depths and internal topology, so any client that can open a connection to the port can read them. Mutual TLS, or mTLS, closes that gap by requiring the scraper to prove its identity with a certificate signed by a CA the exporter trusts, in addition to the server certificate the exporter already presents.
Prometheus supports TLS and client certificate authentication, with TLS 1.2 as the minimum version, so the mechanism is built into the server and exporter web configuration rather than added by a proxy. Server TLS only proves to the scraper who the exporter is. Client authentication adds the reverse check, which is what keeps an unrelated workload from scraping the endpoint even when it can route to it. The client side is configured in tls_config within each scrape job, and the exporter side is configured through its web configuration file, which the sibling TLS section covers in detail.
Choose mTLS over basic authentication when you want identity without shared passwords in configuration, when credentials must rotate on a short schedule, or when auditors ask how each scraper is authenticated. Basic authentication is simpler to operate, but it only works safely when paired with TLS, and it places a secret in every scrape job. Network controls such as firewall rules and separate scrape networks are still worth keeping alongside mTLS. Before committing, confirm with your team which exporters support client authentication in the versions you run, and who will own certificate issuance and renewal.
How Prometheus and an exporter verify each other
The handshake starts when Prometheus opens an HTTPS scrape to the exporter and presents its client certificate, issued by the client CA. The exporter checks that certificate against the client CA named in its web configuration, and only then returns metrics. Service discovery supplies target addresses but does not vouch for identity, so the trust boundary sits between the CA and both sides of the connection. Check that each side trusts only the CA it should, and that the certificate names match the scrape configuration.
Prometheus proves its identity with a CA-issued client certificate that the exporter verifies.
Configuration options in scrape jobs and exporter web configuration
The tls_config block sits under each scrape job in prometheus.yml, or in the equivalent service discovery configuration, and controls two things: which certificate Prometheus presents to the target and which authority it trusts when the target presents its own certificate. Most mutual TLS setups use every field in the block, but each field has a narrow job, and setting one loosely can undo the protection the others provide.
ca_file: The CA bundle Prometheus uses to verify the exporter's server certificate. Point it at the authority that signed the exporter certificate, not at a broad system bundle, so only targets issued by your CA are trusted.cert_fileandkey_file: The client certificate and private key Prometheus presents. The exporter checks this certificate against its own client CA, so these files define the identity that is allowed to scrape.server_name: The name checked against the exporter certificate's subject. Use it when targets are reached by IP address or through a name that the certificate does not list.insecure_skip_verify: Turns off verification of the server certificate. Any certificate is then accepted, so an attacker on the network path can impersonate the exporter and receive the client identity. Keep it off outside short, supervised diagnostics.- Per-job scope: Each job carries its own block, so jobs that scrape different exporter groups can use different CAs and identities.
Before release, confirm that key_file is readable only by the account running Prometheus and that the CA file matches the authority that issued the exporter certificates.
On the exporter side, TLS and client authentication are set in a YAML web configuration file, passed to the exporter with the --web.config.file flag. Prometheus's own web configuration uses the same structure, so the same approach works across the official components that support it. The tls_server_config section holds the exporter's identity and the rules for client certificates, and the strictness of those rules determines whether mutual TLS is enforced at all.
cert_fileandkey_file: The exporter's server certificate and private key, which Prometheus verifies using itsca_file.client_ca_file: The CA bundle used to verify client certificates. Only certificates signed by this authority are accepted, so keep it limited to the CA that issues Prometheus identities.client_auth_type: Set this to the mode that requires and verifies a client certificate. Weaker modes accept connections without a certificate, which removes the point of the exercise.min_version: The lowest TLS version the exporter will negotiate. Prometheus supports TLS 1.2 as a minimum, so set the floor at or above that level.- Endpoint coverage: The web configuration applies to the HTTP endpoints the exporter serves, including the metrics path. Health probes in Kubernetes or load balancers may then need a client certificate, so plan those checks before rollout.
After changes, confirm the exact key names and accepted values against the documentation for each exporter version, since options differ between components and releases.
Mutual TLS works only when the two configurations agree. Prometheus verifies the exporter against its ca_file, the exporter verifies Prometheus against its client_ca_file, and each certificate must chain to the authority the other side trusts. A correct exporter file with a wrong client certificate produces the same failure as no client certificate at all, so the pairing is where most rollouts stall.
- One authority or two: The server and client identities can come from one CA or from separate CAs. Separate authorities limit the damage if one signing key is compromised, but they double the trust bundles to maintain.
- Certificate usage: Confirm that each certificate carries the usage its role needs. Check this with your CA tooling, since requirements depend on how the certificates are issued.
- Failure symptoms: A mismatch usually shows as a target that stays down, with TLS handshake errors in the exporter logs and the
upseries at zero for that job. - Service discovery: Targets generated by service discovery inherit TLS settings only where the provider supports the block. Confirm this for each provider before relying on it.
- Negative testing: Request the metrics endpoint with and without the client certificate. The request without one should be refused, and the Prometheus request should succeed.
Document the expected chain for each job, so that a future certificate rotation can be checked against the same list.
Which mTLS settings fit which scrape setup
This table compares four scrape setups (static targets, file-based service discovery, Kubernetes service discovery and a mixed-CA exporter fleet) and the mTLS settings each one usually needs. Read each row as a question: which setting applies, what it protects and when to choose or avoid it. Confirm every key against the documentation for your Prometheus version before you change production configuration.
| Scrape setup | Settings that apply | What it protects and when to use it |
|---|---|---|
| Static targets | tls_config in the scrape job with ca_file, cert_file and key_file, plus client_ca_file in the exporter web configuration | Small, stable fleets where each target address is fixed. Easy to review in prometheus.yml, but every host change means editing config by hand. |
| File-based service discovery | tls_config in the scrape job, with certificate paths kept identical across target files and the targets listed in file_sd JSON or YAML | Targets change often but not the trust chain. Certificates are shared by the job, so one CA must cover every target listed in the files. |
| Kubernetes service discovery | tls_config in the scrape job with server name checks, typically with certificates mounted from Secrets, and the exporter web configuration mounted alongside it | Pods come and go. Mount certificates from Secrets and plan for rotation, since a restarted pod must read the current files. Confirm the Kubernetes role and relabel rules in your version. |
| Fleet of exporters with mixed certificate authorities | Separate scrape jobs per CA, each with its own ca_file and client credentials, and one client_ca_file per exporter group | Teams or business units that issue certificates from different CAs. Separate jobs keep trust scoped, at the cost of more configuration to maintain and test. |
| Certificate rotation | cert_file and key_file paths in tls_config, reloaded by restarting or reloading Prometheus after new files are in place | Confirm whether your version rereads certificate files without a restart before you depend on it. Test the reload path on a non-production job first. |
| Verification after changes | promtool checks on the configuration and a scrape test against each target group | Shows a missing CA or wrong client certificate before it silently drops metrics. Check the target health page after each change. |
Setting up mTLS on one exporter and a scrape job
This sequence sets up mutual TLS on one exporter and its Prometheus scrape job, so the exporter accepts metrics requests only from a client certificate signed by your own CA. It ends with a configuration that validates, a healthy target, and a documented test showing that a request without the client certificate is refused.
Create a private certificate authority for exporters
The team that runs the monitoring stack creates a certificate authority used only for scrape traffic. Keep its private key offline or in a secrets store with restricted access, and keep it separate from any CA that signs browser-facing certificates. Store the CA certificate, which holds no secret, where both the exporter host and the Prometheus host can read it. Done when the CA certificate can be inspected, the key has a named owner, and the issuing process is written down so later signing steps can be traced.
Issue a server certificate for the exporter
Sign a server certificate for the exporter's host name or address using the private CA from the previous step. The subject alternative name must match the address used in the scrape job, because Prometheus checks it during the TLS handshake. Place the certificate and key on the exporter host, with file permissions that let only the exporter's service account read the key. Done when the certificate output shows the expected names and the issuer is your CA.
Issue a client certificate for Prometheus
Sign a client certificate for the Prometheus server from the same CA, with an identity that names that Prometheus instance clearly. Issue a separate certificate for each Prometheus server, so one server can be rotated or replaced without changing the others. Install the client certificate and key on the Prometheus host, readable only by the Prometheus service user. Done when a test TLS handshake against the exporter using this client certificate completes.
Write the exporter web configuration file
Create a web configuration file for the exporter with a
tls_server_configsection. Pointcert_fileandkey_fileat the server certificate and key, setclient_auth_typeto require and verify client certificates, and setclient_ca_fileto the CA certificate so only certificates from your CA are accepted. Setmin_versionto TLS 1.2, the minimum the Prometheus security model lists, and confirm the key names against the documentation for your exporter version. Done whenpromtool check web-configreports the file as valid.Configure tls_config in the scrape job
In the
prometheus.ymlscrape job for this exporter, set the scheme tohttpsand add atls_configblock. Pointca_fileat the CA certificate, and pointcert_fileandkey_fileat the Prometheus client certificate and key. Addserver_nameif the certificate name differs from the target address. Leaveinsecure_skip_verifyoff, because it disables the check that the exporter's certificate came from your CA. Done when a review of the job confirms each path and name.Validate the configuration and reload Prometheus
Run
promtool check configagainstprometheus.ymland fix any reported errors before applying the change. Apply the change by sending a reload signal to the Prometheus process or by restarting the service, depending on how the server is run. The--web.enable-lifecycleflag enables the HTTP reload endpoint, which is disabled by default, so use it only if your team has already decided to expose it. Done when the targets page shows the exporter as up using the https scheme.Confirm the scrape fails without a client certificate
From a host that does not hold the Prometheus client certificate, run a request against the exporter's metrics path with only the CA certificate supplied (illustrative: a curl call with the CA file and no client key). Confirm the TLS handshake is refused and record the exporter log entry. Then run the same request with the client certificate and confirm metrics are returned. Done when the unauthenticated request is rejected, the authenticated request returns metrics, and both results are saved with the change record.
How certificate rotation works without dropping scrapes
Rotation without dropped scrapes depends on overlapping validity: the replacement client certificate must be issued and deployed before the current one expires. Both certificates should chain to the same internal CA, which stays in the ca_file entry under tls_config on the Prometheus side and in client_ca_file in each exporter's web configuration. Because the CA stays constant, rotating leaf certificates does not require changing every exporter's trust store, as long as the CA itself is not rotated in the same window. Ask your CA owner for the issued lifetime and the renewal lead time, and schedule renewal well inside the old certificate's validity so you have room to recover from a failed rollout.
Prometheus reads the files named by cert_file and key_file in tls_config. Whether it picks up a replaced file on the next scrape, or only after a configuration reload, is the detail to confirm for your Prometheus version in the configuration reference and the Prometheus security model. Confirm the same behavior for each exporter's tls_server_config certificate and client CA files, and whether a restart is needed. Test this in staging by replacing files and watching scrape results instead of assuming. Write new key and certificate files to a temporary path and move them into place, so a partially written file is never read. Then plan the sequence: distribute the new files, reload or restart the exporters, reload Prometheus if required, and verify each target before retiring the old certificate.
The failure mode of an expired client certificate is a failed TLS handshake. The exporter refuses the connection, the scrape returns no samples, and the target's up series drops to 0 until a valid certificate is loaded. Alert on up == 0 for every mTLS job, and read the handshake errors in exporter logs to separate a certificate problem from a network fault, since up alone does not state the cause. Also alert on certificate expiry days before the date, using the expiry metric your exporter or probe tooling exposes, and confirm that metric's name and behavior for your versions before relying on it.
Security and operational risks of mTLS scraping
Client certificates on scrape targets close one gap and open others. The cards below cover the places where mTLS scraping tends to fail: key handling, the trust chain, certificate lifetimes, verification shortcuts, other clients and the parts of Prometheus that mTLS does not protect.
Private key storage and permissions
The Prometheus client key is the credential that lets a scraper pass the exporter's check, so anyone who reads it can scrape the same targets. Store the key on the Prometheus host with owner-only read permissions, keep it out of version control, and confirm the service account that runs Prometheus is the only account that can read it. Ask who else can read the host's configuration directory, since backups and configuration management tools often copy these files.
Security modelCertificate authority compromise and scope
Every exporter trusts the client CA, so a stolen CA key lets an attacker mint a client certificate that the whole fleet accepts. Keep the CA offline or in a managed key store, and issue a separate intermediate CA for scraping rather than reusing an internal CA that signs other systems. Confirm which certificates the exporters accept as client certificates, because a broad CA can authenticate clients that were never meant to scrape.
Expiry that silently drops targets
When a client or server certificate expires, the scrape fails with a TLS error and the target disappears from the metrics without a single alert firing unless you write one. Track the expiry date of every certificate in the scrape path, alert well before it passes, and test the rotation procedure on a non-production target. Ask whether your certificate management tool can reload Prometheus and exporters after renewal without a restart.
Verification disabled with insecure_skip_verify
Setting insecure_skip_verify: true under tls_config makes Prometheus accept any server certificate, which removes the check that it is talking to the real exporter. The setting is often added during a first test and left in place. Search every scrape job for it during reviews, and require the ca_file for the exporter's certificate authority so verification stays on in production.
Other scrapers need their own identities
When exporters accept only Prometheus, any other tool that scrapes them, such as a second Prometheus, an agent or a health checker, will fail until it has its own certificate. Plan a client identity for each scraper, and decide whether the exporter should map each certificate to a distinct permission set. Ask who issues these identities and how they are revoked when a scraper is retired.
Admin APIs and URL-parameter exporters remain exposed
Client certificates on exporter endpoints do not protect the Prometheus admin APIs, the lifecycle endpoints or the web UI, which need their own controls. Blackbox and SNMP exporters that take targets from URL parameters can still be used to send requests to internal addresses by anyone who can reach them with a valid certificate. Restrict the admin endpoints separately, and pair mTLS with network placement and module restrictions on those exporters.
Security modelQuestions teams ask before requiring mTLS on exporters
How much effort does requiring mTLS on exporters take, and who does the work?
The effort is driven by how many exporters and scrape jobs you run, how many certificate authorities you already operate, and whether certificates are issued by a tool your team already trusts. Your platform or security team typically owns the internal CA decisions, while the monitoring team edits the scrape jobs and exporter web configuration files. A partner can take on the design, the configuration across Prometheus and each exporter, validation and handover, under a written scope. Ask any provider to list which exporters, jobs and certificate paths are in scope before agreeing a timeline, since no duration is fixed by the Prometheus project itself.
Can our in-house team set up mTLS on Prometheus scrape targets alone?
Yes, if your team already runs a private CA, understands TLS and can edit configuration files as code. Prometheus supports client certificate authentication, and the work is mostly configuration: a tls_config block in each scrape job that presents a client certificate and trusts the server CA, plus client CA settings in each exporter's web configuration file. The harder parts are usually certificate issuance, distribution to every target and rotation without downtime. Teams without that experience often benefit from a short design review and a test environment before touching production. Confirm that someone on your team owns the certificate lifecycle after go-live, because mTLS failures that come from expired certificates look like outages.
How does mTLS work with service discovery and dynamic targets?
Service discovery does not change the TLS requirement, but it changes how certificates reach targets. Prometheus can find targets through Kubernetes, cloud APIs or file-based discovery, and each scrape job still needs a tls_config that matches the certificates on those targets. If targets are created automatically, the certificate issuance step must run automatically too, for example through a cluster-native issuer or an automation tool your team already uses. Also check that discovery labels do not expose certificate material, and that a new target without a certificate fails visibly rather than silently disappearing from dashboards. Test one newly created target end to end before relying on discovery for the whole estate.
What does mTLS cost in infrastructure, given Prometheus has no license fee?
Prometheus is licensed under Apache-2.0, and the project has no paid enterprise edition, so there is no license fee for enabling mTLS. The costs that remain are the people who design and run it, the private CA or certificate tooling you choose, the time to issue, distribute and rotate certificates, and any hardware or virtual machines used for test environments. The certificate tooling may be an existing platform you already pay for, or a new component with its own licensing terms, so check those separately. Ask a provider to split any quote into design, implementation, validation and ongoing rotation support, and to state which parts are one-time and which recur.
What do you need from our team before a partner can start?
A partner needs read access to the current Prometheus configuration, a list of exporters and scrape jobs with their versions, the existing certificate authority arrangement, and a named owner for approvals on both the security and monitoring sides. They also need a test environment or a safe window where changes can be made and rolled back, plus the rules for how certificates are stored and who may issue them. Expect to provide the network paths between Prometheus and each target, so that firewall rules can be checked. Written scope should list these inputs as dependencies, because a delay in any of them moves the schedule.
What should we confirm about our exporters and certificate tooling first?
Confirm which exporters you run, their versions, and whether each one supports the web configuration file that handles TLS and client CA settings. Check the certificate tooling as well: which CA issues certificates, how long they last, how rotation works, and whether Prometheus picks up renewed certificates without a restart. Confirm whether any exporter runs in a mode that cannot present or verify client certificates, and whether a reverse proxy sits in front of it. The Prometheus security model and each exporter's documentation are the places to verify these capabilities, since support differs by project and version.
What risks should we plan for when enforcing client certificates?
The main risks are outages from expired or unrotated certificates, scrape gaps when a new target is missing its certificate, and misconfigured trust that either rejects Prometheus or accepts unintended clients. Plan a staged rollout that adds certificates and trust in parallel before tightening enforcement, and keep a documented rollback. Monitor the Prometheus up metric for each job during rollout so that failures are visible. Certificate private keys need the same protection as other credentials, and this topic pairs with the guidance on keeping secrets out of configuration files. A partner can test these failure modes in a staging environment before production changes.
Limits to confirm in your environment
Mutual TLS depends on several pieces lining up: the exporter, the Prometheus version, the discovery mechanism, the key storage and the connections around the scrape path. Verify each one against your own versions and infrastructure before you commit to a certificate design.
Exporter client CA support
Mutual TLS only works if each exporter reads a client CA setting from its web configuration file. Support differs by exporter and by version, so check the exact release you run for the client authentication options in its web configuration reference. Where an exporter does not support client certificates, plan a network control or a reverse proxy in front of it and record that exception explicitly.
Prometheus security modelPrometheus version and TLS minimums
Confirm the Prometheus version you plan to run and its TLS settings before you choose cipher and protocol policy. Prometheus supports TLS 1.2 as the minimum, so check whether your security baseline requires more and whether your exporters enforce the same floor. Also confirm the release line you will stay on, since a minor release generally stops receiving bug fixes six weeks after its cycle begins.
Per-target TLS in discovery
Static configuration makes per-job tls_config straightforward, but service discovery may not carry per-target certificate paths or server names for every target. Test how your discovery mechanism passes labels and settings, and whether certificate files can be mounted or referenced consistently on every scraped host. If discovery cannot express the setting, group targets into jobs that do.
Key storage and hardware
Client private keys must live somewhere the scraping host can read but other processes cannot. Confirm whether your hosts offer a TPM, an HSM or a secrets manager you can use for key material, and whether your team can rotate those keys without a manual step on every exporter. Record who holds the CA private key and how it is protected.
Alertmanager and Grafana authentication
Mutual TLS on scrape targets does not automatically cover the other connections in your monitoring path. Confirm how Prometheus authenticates to Alertmanager, whether Alertmanager accepts client certificates, and how Grafana connects to Prometheus, including whether it presents a certificate or relies on a proxy. Each connection needs its own trust bundle and its own rotation plan.
How DeployOpen scopes and delivers mTLS for Prometheus
Mutual TLS between Prometheus and its scrape targets is delivered as a fixed-scope engagement, with the scope, deliverables and sequence agreed in writing before any work starts. The written scope names the Prometheus servers, the exporters and jobs in scope (node, application and any custom exporters), the service discovery method, and the environments covered. It also states what is excluded, such as Alertmanager, the Pushgateway or remote write endpoints, so that the certificate work does not quietly expand. Because DeployOpen does not publish a price list, a quote follows from this written scope, and the scope is where the reader should check that the number of targets, environments and certificate authorities is spelled out.
Planning comes first and is the part most likely to decide whether the rollout holds. DeployOpen plans the certificate authority the client already runs or approves, who issues and signs exporter and Prometheus certificates, how the client certificate subject or SAN is checked, and how rotation works before any exporter is changed. The plan covers how certificates reach each host, how exporters reload them, and how Prometheus tls_config files are updated across all jobs. Clients should confirm the CA ownership, their change windows and their monitoring of certificate expiry with their own PKI team, since those decisions sit in their environment.
Implementation happens inside the client's own infrastructure, using their cloud accounts, data centers or private networks and their existing configuration management. DeployOpen configures the web configuration files on exporters, the client CA settings and the tls_config blocks in scrape jobs, then validates the result with promtool and by confirming that Prometheus is refused by a scrape request without a valid client certificate. Validation is followed by handover: documented steps for rotation, a runbook for failed scrapes, and written evidence of what was tested. Ongoing support, upgrades and continuous testing can be added as an optional retainer once the handover is complete, and the retainer scope is agreed separately in writing.

