General availability (GA) Open source Grafana Cloud

prometheus.operator.probes

prometheus.operator.probes discovers Probe resources in your Kubernetes cluster and scrapes the targets they reference. This component performs three main functions:

  1. Discover Probe resources from your Kubernetes cluster.
  2. Discover targets or ingresses that match those Probes.
  3. Scrape metrics from those endpoints, and forward them to a receiver.

The default configuration assumes Alloy is running inside a Kubernetes cluster, and uses the in-cluster configuration to access the Kubernetes API. You can run it from outside the cluster by supplying connection info in the client block, but network level access to pods is required to scrape metrics from them.

Probes may reference secrets for authenticating to targets to scrape them. In these cases, the secrets are loaded and refreshed only when the Probe is updated or when this component refreshes its’ internal state, which happens on a 5-minute refresh cycle.

Usage

Alloy
prometheus.operator.probes "<LABEL>" {
    forward_to = <RECEIVER_LIST>
}

Arguments

You can use the following arguments with prometheus.operator.probes:

NameTypeDescriptionDefaultRequired
forward_tolist(MetricsReceiver)List of receivers to send scraped metrics to.yes
informer_sync_timeoutdurationTimeout for initial sync of Probe resources."1m"no
namespaceslist(string)List of namespaces to search for Probe resources. If not specified, all namespaces are searched.no

Blocks

You can use the following blocks with prometheus.operator.probes:

client

The client block configures the Kubernetes client used to discover Probes. If the client block isn’t provided, the default in-cluster configuration with the service account of the running Alloy Pod is used.

The following arguments are supported:

NameTypeDescriptionDefaultRequired
api_serverstringURL of the Kubernetes API server.no
bearer_token_filestringFile containing a bearer token to authenticate with.no
bearer_tokensecretBearer token to authenticate with.no
enable_http2boolWhether HTTP2 is supported for requests.trueno
follow_redirectsboolWhether redirects returned by the server should be followed.trueno
http_headersmap(list(secret))Custom HTTP headers to be sent along with each request. The map key is the header name.no
kubeconfig_filestringPath of the kubeconfig file to use for connecting to Kubernetes.no
no_proxystringComma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.no
proxy_connect_headermap(list(secret))Specifies headers to send to proxies during CONNECT requests.no
proxy_from_environmentboolUse the proxy URL indicated by environment variables.falseno
proxy_urlstringHTTP proxy to send requests through.no

At most, one of the following can be provided:

no_proxy can contain IPs, CIDR notations, and domain names. IP and domain names can contain port numbers. proxy_url must be configured if no_proxy is configured.

proxy_from_environment uses the environment variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (or the lowercase versions thereof). Requests use the proxy from the environment variable matching their scheme, unless excluded by NO_PROXY. proxy_url and no_proxy must not be configured if proxy_from_environment is configured.

proxy_connect_header should only be configured if proxy_url or proxy_from_environment are configured.

authorization

NameTypeDescriptionDefaultRequired
credentials_filestringFile containing the secret value.no
credentialssecretSecret value.no
typestringAuthorization type, for example, “Bearer”.no

credential and credentials_file are mutually exclusive, and only one can be provided inside an authorization block.

Warning

Using credentials_file causes the file to be read on every outgoing request. Use the local.file component with the credentials attribute instead to avoid unnecessary reads.

basic_auth

NameTypeDescriptionDefaultRequired
password_filestringPath to a file that contains the basic auth password.no
passwordsecretBasic auth password.no
usernamestringBasic auth username.no

When you use password_file, the file is read on every outgoing request that uses basic authentication.

password and password_file are mutually exclusive, and only one can be provided inside a basic_auth block.

Note

High scrape or write rates create repeated file reads when you use password_file. You can use the local.file component to read the password file and provide the content to the password attribute. This avoids repeated file reads because local.file monitors the file and reads when it changes.

oauth2