PodMonitor
Scope: Namespaced
Version: v1
PodMonitor defines monitoring for a set of pods.
- apiVersion
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
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
- metadata
- spec
Required value
Specification of desired Pod selection for target discovery by Prometheus.
- spec.attachMetadata
Attaches node metadata to discovered targets. Requires Prometheus v2.35.0 and above.
- spec.attachMetadata.node
When set to true, Prometheus must have permissions to get Nodes.
- spec.jobLabel
The label to use to retrieve the job name from.
- spec.keepDroppedTargets
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.
- spec.labelLimit
Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
- spec.labelNameLengthLimit
Per-scrape limit on length of labels name that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
- spec.labelValueLengthLimit
Per-scrape limit on length of labels value that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
- spec.namespaceSelector
Selector to select which namespaces the Endpoints objects are discovered from.
- spec.namespaceSelector.any
Boolean describing whether all namespaces are selected in contrast to a list restricting them.
- spec.namespaceSelector.matchNames
List of namespace names to select from.
- spec.podMetricsEndpoints
Required value
A list of endpoints allowed as part of this PodMonitor.
PodMetricsEndpoint defines a scrapeable endpoint of a Kubernetes Pod serving Prometheus metrics.
- object
Authorization section for this endpoint
- object
Selects a key of a Secret in the namespace that contains the credentials for authentication.
- string
Required value
The key of the secret to select from. Must be a valid secret key.
- string
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- boolean
Specify whether the Secret or its key must be defined
- string
Defines the authentication type. The value is case-insensitive. “Basic” is not a supported value. Default: “Bearer”
- spec.podMetricsEndpoints.basicAuth
BasicAuth allow an endpoint to authenticate over basic authentication. More info: https://prometheus.io/docs/operating/configuration/#endpoint
- spec.podMetricsEndpoints.basicAuth.password
The secret in the service monitor namespace that contains the password for authentication.
- spec.podMetricsEndpoints.basicAuth.password.key
Required value
The key of the secret to select from. Must be a valid secret key.
- spec.podMetricsEndpoints.basicAuth.password.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.basicAuth.password.optional
Specify whether the Secret or its key must be defined
- spec.podMetricsEndpoints.basicAuth.username
The secret in the service monitor namespace that contains the username for authentication.
- spec.podMetricsEndpoints.basicAuth.username.key
Required value
The key of the secret to select from. Must be a valid secret key.
- spec.podMetricsEndpoints.basicAuth.username.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.basicAuth.username.optional
Specify whether the Secret or its key must be defined
- spec.podMetricsEndpoints.bearerTokenSecret
Secret to mount to read bearer token for scraping targets. The secret needs to be in the same namespace as the pod monitor and accessible by the Prometheus Operator.
- spec.podMetricsEndpoints.bearerTokenSecret.key
Required value
The key of the secret to select from. Must be a valid secret key.
- spec.podMetricsEndpoints.bearerTokenSecret.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.bearerTokenSecret.optional
Specify whether the Secret or its key must be defined
- spec.podMetricsEndpoints.enableHttp2
Whether to enable HTTP2.
- spec.podMetricsEndpoints.filterRunning
Drop pods that are not running. (Failed, Succeeded). Enabled by default. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase
- spec.podMetricsEndpoints.followRedirects
FollowRedirects configures whether scrape requests follow HTTP 3xx redirects.
- spec.podMetricsEndpoints.honorLabels
HonorLabels chooses the metric’s labels on collisions with target labels.
- spec.podMetricsEndpoints.honorTimestamps
HonorTimestamps controls whether Prometheus respects the timestamps present in scraped data.
- spec.podMetricsEndpoints.interval
Interval at which metrics should be scraped If not specified Prometheus’ global scrape interval is used.
Pattern:
^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
- spec.podMetricsEndpoints.metricRelabelings
MetricRelabelConfigs to apply to samples before ingestion.
RelabelConfig allows dynamic rewriting of the label set for targets, alerts, scraped samples and remote write samples. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
- spec.podMetricsEndpoints.metricRelabelings.action
Action to perform based on the regex matching.
Uppercase
andLowercase
actions require Prometheus >= v2.36.0.DropEqual
andKeepEqual
actions require Prometheus >= v2.41.0. Default: “Replace”Default:
"replace"
Allowed values:
replace
,Replace
,keep
,Keep
,drop
,Drop
,hashmod
,HashMod
,labelmap
,LabelMap
,labeldrop
,LabelDrop
,labelkeep
,LabelKeep
,lowercase
,Lowercase
,uppercase
,Uppercase
,keepequal
,KeepEqual
,dropequal
,DropEqual
- spec.podMetricsEndpoints.metricRelabelings.modulus
Modulus to take of the hash of the source label values. Only applicable when the action is
HashMod
. - spec.podMetricsEndpoints.metricRelabelings.regex
Regular expression against which the extracted value is matched.
- spec.podMetricsEndpoints.metricRelabelings.replacement
Replacement value against which a Replace action is performed if the regular expression matches. Regex capture groups are available.
- spec.podMetricsEndpoints.metricRelabelings.separator
Separator is the string between concatenated SourceLabels.
- spec.podMetricsEndpoints.metricRelabelings.sourceLabels
The source labels select values from existing labels. Their content is concatenated using the configured Separator and matched against the configured regular expression.
- Element of the array
LabelName is a valid Prometheus label name which may only contain ASCII letters, numbers, as well as underscores.
Pattern:
^[a-zA-Z_][a-zA-Z0-9_]*$
- spec.podMetricsEndpoints.metricRelabelings.targetLabel
Label to which the resulting string is written in a replacement. It is mandatory for
Replace
,HashMod
,Lowercase
,Uppercase
,KeepEqual
andDropEqual
actions. Regex capture groups are available.
- spec.podMetricsEndpoints.oauth2
OAuth2 for the URL. Only valid in Prometheus versions 2.27.0 and newer.
- spec.podMetricsEndpoints.oauth2.clientId
Required value
The secret or configmap containing the OAuth2 client id
- spec.podMetricsEndpoints.oauth2.clientId.configMap
ConfigMap containing data to use for the targets.
- spec.podMetricsEndpoints.oauth2.clientId.configMap.key
Required value
The key to select.
- spec.podMetricsEndpoints.oauth2.clientId.configMap.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.oauth2.clientId.configMap.optional
Specify whether the ConfigMap or its key must be defined
- spec.podMetricsEndpoints.oauth2.clientId.secret
Secret containing data to use for the targets.
- spec.podMetricsEndpoints.oauth2.clientId.secret.key
Required value
The key of the secret to select from. Must be a valid secret key.
- spec.podMetricsEndpoints.oauth2.clientId.secret.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.oauth2.clientId.secret.optional
Specify whether the Secret or its key must be defined
- spec.podMetricsEndpoints.oauth2.clientSecret
Required value
The secret containing the OAuth2 client secret
- spec.podMetricsEndpoints.oauth2.clientSecret.key
Required value
The key of the secret to select from. Must be a valid secret key.
- spec.podMetricsEndpoints.oauth2.clientSecret.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.oauth2.clientSecret.optional
Specify whether the Secret or its key must be defined
- spec.podMetricsEndpoints.oauth2.endpointParams
Parameters to append to the token URL
- spec.podMetricsEndpoints.oauth2.scopes
OAuth2 scopes used for the token request
- spec.podMetricsEndpoints.oauth2.tokenUrl
Required value
The URL to fetch the token from
- spec.podMetricsEndpoints.params
Optional HTTP URL parameters
- spec.podMetricsEndpoints.path
HTTP path to scrape for metrics. If empty, Prometheus uses the default value (e.g.
/metrics
). - spec.podMetricsEndpoints.port
Name of the pod port this endpoint refers to. Mutually exclusive with targetPort.
- spec.podMetricsEndpoints.proxyUrl
ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
- spec.podMetricsEndpoints.relabelings
RelabelConfigs to apply to samples before scraping. Prometheus 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_configRelabelConfig allows dynamic rewriting of the label set for targets, alerts, scraped samples and remote write samples. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
- spec.podMetricsEndpoints.relabelings.action
Action to perform based on the regex matching.
Uppercase
andLowercase
actions require Prometheus >= v2.36.0.DropEqual
andKeepEqual
actions require Prometheus >= v2.41.0. Default: “Replace”Default:
"replace"
Allowed values:
replace
,Replace
,keep
,Keep
,drop
,Drop
,hashmod
,HashMod
,labelmap
,LabelMap
,labeldrop
,LabelDrop
,labelkeep
,LabelKeep
,lowercase
,Lowercase
,uppercase
,Uppercase
,keepequal
,KeepEqual
,dropequal
,DropEqual
- spec.podMetricsEndpoints.relabelings.modulus
Modulus to take of the hash of the source label values. Only applicable when the action is
HashMod
. - spec.podMetricsEndpoints.relabelings.regex
Regular expression against which the extracted value is matched.
- spec.podMetricsEndpoints.relabelings.replacement
Replacement value against which a Replace action is performed if the regular expression matches. Regex capture groups are available.
- spec.podMetricsEndpoints.relabelings.separator
Separator is the string between concatenated SourceLabels.
- spec.podMetricsEndpoints.relabelings.sourceLabels
The source labels select values from existing labels. Their content is concatenated using the configured Separator and matched against the configured regular expression.
- Element of the array
LabelName is a valid Prometheus label name which may only contain ASCII letters, numbers, as well as underscores.
Pattern:
^[a-zA-Z_][a-zA-Z0-9_]*$
- spec.podMetricsEndpoints.relabelings.targetLabel
Label to which the resulting string is written in a replacement. It is mandatory for
Replace
,HashMod
,Lowercase
,Uppercase
,KeepEqual
andDropEqual
actions. Regex capture groups are available.
- spec.podMetricsEndpoints.scheme
HTTP scheme to use for scraping.
http
andhttps
are the expected values unless you rewrite the__scheme__
label via relabeling. If empty, Prometheus uses the default valuehttp
.Allowed values:
http
,https
- spec.podMetricsEndpoints.scrapeTimeout
Timeout after which the scrape is ended If not specified, the Prometheus global scrape interval is used.
Pattern:
^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
- spec.podMetricsEndpoints.targetPort
Deprecated: Use ‘port’ instead.
- spec.podMetricsEndpoints.tlsConfig
TLS configuration to use when scraping the endpoint.
- spec.podMetricsEndpoints.tlsConfig.ca
Certificate authority used when verifying server certificates.
- spec.podMetricsEndpoints.tlsConfig.ca.configMap
ConfigMap containing data to use for the targets.
- spec.podMetricsEndpoints.tlsConfig.ca.configMap.key
Required value
The key to select.
- spec.podMetricsEndpoints.tlsConfig.ca.configMap.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.tlsConfig.ca.configMap.optional
Specify whether the ConfigMap or its key must be defined
- spec.podMetricsEndpoints.tlsConfig.ca.secret
Secret containing data to use for the targets.
- spec.podMetricsEndpoints.tlsConfig.ca.secret.key
Required value
The key of the secret to select from. Must be a valid secret key.
- spec.podMetricsEndpoints.tlsConfig.ca.secret.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.tlsConfig.ca.secret.optional
Specify whether the Secret or its key must be defined
- spec.podMetricsEndpoints.tlsConfig.cert
Client certificate to present when doing client-authentication.
- spec.podMetricsEndpoints.tlsConfig.cert.configMap
ConfigMap containing data to use for the targets.
- spec.podMetricsEndpoints.tlsConfig.cert.configMap.key
Required value
The key to select.
- spec.podMetricsEndpoints.tlsConfig.cert.configMap.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.tlsConfig.cert.configMap.optional
Specify whether the ConfigMap or its key must be defined
- spec.podMetricsEndpoints.tlsConfig.cert.secret
Secret containing data to use for the targets.
- spec.podMetricsEndpoints.tlsConfig.cert.secret.key
Required value
The key of the secret to select from. Must be a valid secret key.
- spec.podMetricsEndpoints.tlsConfig.cert.secret.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.tlsConfig.cert.secret.optional
Specify whether the Secret or its key must be defined
- spec.podMetricsEndpoints.tlsConfig.insecureSkipVerify
Disable target certificate validation.
- spec.podMetricsEndpoints.tlsConfig.keySecret
Secret containing the client key file for the targets.
- spec.podMetricsEndpoints.tlsConfig.keySecret.key
Required value
The key of the secret to select from. Must be a valid secret key.
- spec.podMetricsEndpoints.tlsConfig.keySecret.name
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
- spec.podMetricsEndpoints.tlsConfig.keySecret.optional
Specify whether the Secret or its key must be defined
- spec.podMetricsEndpoints.tlsConfig.serverName
Used to verify the hostname for the targets.
- spec.podTargetLabels
PodTargetLabels transfers labels on the Kubernetes Pod onto the target.
- spec.sampleLimit
SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
- spec.selector
Required value
Selector to select Pod objects.
- spec.selector.matchExpressions
matchExpressions is a list of label selector requirements. The requirements are ANDed.
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
- spec.selector.matchExpressions.key
Required value
key is the label key that the selector applies to.
- spec.selector.matchExpressions.operator
Required value
operator represents a key’s relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
- spec.selector.matchExpressions.values
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.
- spec.selector.matchLabels
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.
- spec.targetLimit
TargetLimit defines a limit on the number of scraped targets that will be accepted.