The `PodMonitor` custom resource definition (CRD) defines how `Prometheus` and `PrometheusAgent` can scrape metrics from a group of pods. Among other things, it allows to specify: * The pods to scrape via label selectors. * The container ports to scrape. * Authentication credentials to use. * Target and metric relabeling. `Prometheus` and `PrometheusAgent` objects select `PodMonitor` objects using label and namespace selectors.
Last changed in Prometheus Operator v0.77.0
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Specification of desired Pod selection for target discovery by Prometheus.
`attachMetadata` defines additional metadata which is added to the discovered targets. It requires Prometheus >= v2.35.0.
When set to true, Prometheus attaches node metadata to the discovered targets. The Prometheus service account must have the `list` and `watch` permissions on the `Nodes` objects.
When defined, bodySizeLimit specifies a job level limit on the size of uncompressed response body that will be accepted by Prometheus. It requires Prometheus >= v2.28.0.
The label to use to retrieve the job name from. `jobLabel` selects the label from the associated Kubernetes `Pod` object which will be used as the `job` label for all metrics. For example if `jobLabel` is set to `foo` and the Kubernetes `Pod` object is labeled with `foo: bar`, then Prometheus adds the `job="bar"` label to all ingested metrics. If the value of this field is empty, the `job` label of the metrics defaults to the namespace and name of the PodMonitor object (e.g. `<namespace>/<name>`).
Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit. It requires Prometheus >= v2.47.0.
Per-scrape limit on number of labels that will be accepted for a sample. It requires Prometheus >= v2.27.0.
Per-scrape limit on length of labels name that will be accepted for a sample. It requires Prometheus >= v2.27.0.
Per-scrape limit on length of labels value that will be accepted for a sample. It requires Prometheus >= v2.27.0.
`namespaceSelector` defines in which namespace(s) Prometheus should discover the pods. By default, the pods are discovered in the same namespace as the `PodMonitor` object but it is possible to select pods across different/all namespaces.
Boolean describing whether all namespaces are selected in contrast to a list restricting them.
List of namespace names to select from.
Defines how to scrape metrics from the selected pods.
`authorization` configures the Authorization header credentials to use when scraping the target. Cannot be set at the same time as `basicAuth`, or `oauth2`.
Selects a key of a Secret in the namespace that contains the credentials for authentication.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
Defines the authentication type. The value is case-insensitive. "Basic" is not a supported value. Default: "Bearer"
`basicAuth` configures the Basic Authentication credentials to use when scraping the target. Cannot be set at the same time as `authorization`, or `oauth2`.
`password` specifies a key of a Secret containing the password for authentication.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
`username` specifies a key of a Secret containing the username for authentication.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
`bearerTokenSecret` specifies a key of a Secret containing the bearer token for scraping targets. The secret needs to be in the same namespace as the PodMonitor object and readable by the Prometheus Operator. Deprecated: use `authorization` instead.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
`enableHttp2` can be used to disable HTTP2 when scraping the target.
When true, the pods which are not running (e.g. either in Failed or Succeeded state) are dropped during the target discovery. If unset, the filtering is enabled. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase
`followRedirects` defines whether the scrape requests should follow HTTP 3xx redirects.
When true, `honorLabels` preserves the metric's labels when they collide with the target's labels.
`honorTimestamps` controls whether Prometheus preserves the timestamps when exposed by the target.
Interval at which Prometheus scrapes the metrics from the target. If empty, Prometheus uses the global scrape interval.
`metricRelabelings` configures the relabeling rules to apply to the samples before ingestion.
Action to perform based on the regex matching. `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0. `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0. Default: "Replace"
Modulus to take of the hash of the source label values. Only applicable when the action is `HashMod`.
Regular expression against which the extracted value is matched.
Replacement value against which a Replace action is performed if the regular expression matches. Regex capture groups are available.
Separator is the string between concatenated SourceLabels.
The source labels select values from existing labels. Their content is concatenated using the configured Separator and matched against the configured regular expression.
Label to which the resulting string is written in a replacement. It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`, `KeepEqual` and `DropEqual` actions. Regex capture groups are available.
`oauth2` configures the OAuth2 settings to use when scraping the target. It requires Prometheus >= 2.27.0. Cannot be set at the same time as `authorization`, or `basicAuth`.
`clientId` specifies a key of a Secret or ConfigMap containing the OAuth2 client's ID.
ConfigMap containing data to use for the targets.
The key to select.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the ConfigMap or its key must be defined
Secret containing data to use for the targets.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
`clientSecret` specifies a key of a Secret containing the OAuth2 client's secret.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
`endpointParams` configures the HTTP parameters to append to the token URL.
`noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names that should be excluded from proxying. IP and domain names can contain port numbers. It requires Prometheus >= v2.43.0 or Alertmanager >= 0.25.0.
ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. It requires Prometheus >= v2.43.0 or Alertmanager >= 0.25.0.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
Whether to use the proxy configuration defined by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY). It requires Prometheus >= v2.43.0 or Alertmanager >= 0.25.0.
`proxyURL` defines the HTTP proxy server to use.
`scopes` defines the OAuth2 scopes used for the token request.
TLS configuration to use when connecting to the OAuth2 server. It requires Prometheus >= v2.43.0.
Certificate authority used when verifying server certificates.
ConfigMap containing data to use for the targets.
The key to select.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the ConfigMap or its key must be defined
Secret containing data to use for the targets.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
Client certificate to present when doing client-authentication.
ConfigMap containing data to use for the targets.
The key to select.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the ConfigMap or its key must be defined
Secret containing data to use for the targets.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
Disable target certificate validation.
Secret containing the client key file for the targets.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
Maximum acceptable TLS version. It requires Prometheus >= v2.41.0.
Minimum acceptable TLS version. It requires Prometheus >= v2.35.0.
Used to verify the hostname for the targets.
`tokenURL` configures the URL to fetch the token from.
`params` define optional HTTP URL parameters.
HTTP path from which to scrape for metrics. If empty, Prometheus uses the default value (e.g. `/metrics`).
Name of the Pod port which this endpoint refers to. It takes precedence over `targetPort`.
`proxyURL` configures the HTTP Proxy URL (e.g. "http://proxyserver:2195") to go through when scraping the target.
`relabelings` configures the relabeling rules to apply the target's metadata labels. The Operator automatically adds relabelings for a few standard Kubernetes fields. The original scrape job's name is available via the `__tmp_prometheus_job_name` label. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
Action to perform based on the regex matching. `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0. `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0. Default: "Replace"
Modulus to take of the hash of the source label values. Only applicable when the action is `HashMod`.
Regular expression against which the extracted value is matched.
Replacement value against which a Replace action is performed if the regular expression matches. Regex capture groups are available.
Separator is the string between concatenated SourceLabels.
The source labels select values from existing labels. Their content is concatenated using the configured Separator and matched against the configured regular expression.
Label to which the resulting string is written in a replacement. It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`, `KeepEqual` and `DropEqual` actions. Regex capture groups are available.
HTTP scheme to use for scraping. `http` and `https` are the expected values unless you rewrite the `__scheme__` label via relabeling. If empty, Prometheus uses the default value `http`.
Timeout after which Prometheus considers the scrape to be failed. If empty, Prometheus uses the global scrape timeout unless it is less than the target's scrape interval value in which the latter is used.
Name or number of the target port of the `Pod` object behind the Service, the port must be specified with container port property. Deprecated: use 'port' instead.
TLS configuration to use when scraping the target.
Certificate authority used when verifying server certificates.
ConfigMap containing data to use for the targets.
The key to select.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the ConfigMap or its key must be defined
Secret containing data to use for the targets.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
Client certificate to present when doing client-authentication.
ConfigMap containing data to use for the targets.
The key to select.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the ConfigMap or its key must be defined
Secret containing data to use for the targets.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
Disable target certificate validation.
Secret containing the client key file for the targets.
The key of the secret to select from. Must be a valid secret key.
Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Specify whether the Secret or its key must be defined
Maximum acceptable TLS version. It requires Prometheus >= v2.41.0.
Minimum acceptable TLS version. It requires Prometheus >= v2.35.0.
Used to verify the hostname for the targets.
`trackTimestampsStaleness` defines whether Prometheus tracks staleness of the metrics that have an explicit timestamp present in scraped data. Has no effect if `honorTimestamps` is false. It requires Prometheus >= v2.48.0.
`podTargetLabels` defines the labels which are transferred from the associated Kubernetes `Pod` object onto the ingested metrics.
`sampleLimit` defines a per-scrape limit on the number of scraped samples that will be accepted.
The scrape class to apply.
`scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the protocols supported by Prometheus in order of preference (from most to least preferred). If unset, Prometheus uses its default value. It requires Prometheus >= v2.49.0.
Label selector to select the Kubernetes `Pod` objects to scrape metrics from.
matchExpressions is a list of label selector requirements. The requirements are ANDed.
key is the label key that the selector applies to.
operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
`targetLimit` defines a limit on the number of scraped targets that will be accepted.
Source: bundle.yaml
Changes to PodMonitor (monitoring.coreos.com/v1) in each Prometheus Operator version, compared to the version before it.
The description of PodMonitor has changed
57 properties have changed the description
Released · View PodMonitor in v0.77.0
7 properties have been added
The description of PodMonitor has changed
5 properties have changed the description
Released · View PodMonitor in v0.76.0
12 properties have changed the description
Released · View PodMonitor in v0.75.0
65 properties have changed the description
Released · View PodMonitor in v0.74.0
1 property has been added
Released · View PodMonitor in v0.73.0
2 properties have been added
Released · View PodMonitor in v0.72.0
1 property has been added
1 property is no longer required
39 properties have changed the description
Released · View PodMonitor in v0.70.0
1 property has been added
Released · View PodMonitor in v0.68.0
16 properties have changed the description
Released · View PodMonitor in v0.67.0
1 property has changed the description
Released · View PodMonitor in v0.65.0
3 properties have changed the description
Released · View PodMonitor in v0.61.0
1 property has been added
Released · View PodMonitor in v0.60.0
1 property has been added
3 properties have changed the description
Released · View PodMonitor in v0.58.0
1 property has been added
Released · View PodMonitor in v0.57.0
2 properties have changed the description
Released · View PodMonitor in v0.56.0
1 property has been added
2 properties have changed the description
Released · View PodMonitor in v0.55.0
5 properties have been added
Released · View PodMonitor in v0.50.0
1 property has changed the description
Released · View PodMonitor in v0.47.0
4 properties have been added
Released · View PodMonitor in v0.43.0
2 properties have changed the description
Released · View PodMonitor in v0.38.0
1 property has been added
3 properties have changed type
1 property is now required
The description of PodMonitor has changed
6 properties have changed the description
Released · View PodMonitor in v0.35.0
1 property has been added
2 properties have changed the description
Released · View PodMonitor in v0.34.0
PodMonitor was first seen on this version of Prometheus Operator
Released · View PodMonitor in v0.31.0
No examples of PodMonitor yet. Contribute one on GitHub.