×
Description

PodMonitor defines monitoring for a set of pods.

Type

object

Required
  • spec

Specification

Property Type Description

apiVersion

string

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

string

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

ObjectMeta_v2

Standard object’s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

spec

object

Specification of desired Pod selection for target discovery by Prometheus.

.spec

Description

Specification of desired Pod selection for target discovery by Prometheus.

Type

object

Required
  • podMetricsEndpoints

  • selector

Property Type Description

attachMetadata

object

Attaches node metadata to discovered targets. Only valid for role: pod. Only valid in Prometheus versions 2.35.0 and newer.

jobLabel

string

The label to use to retrieve the job name from.

labelLimit

integer

Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.

labelNameLengthLimit

integer

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.

labelValueLengthLimit

integer

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.

namespaceSelector

object

Selector to select which namespaces the Endpoints objects are discovered from.

podMetricsEndpoints

array

A list of endpoints allowed as part of this PodMonitor.

podMetricsEndpoints[]

object

PodMetricsEndpoint defines a scrapeable endpoint of a Kubernetes Pod serving Prometheus metrics.

podTargetLabels

array (string)

PodTargetLabels transfers labels on the Kubernetes Pod onto the target.

sampleLimit

integer

SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.

selector

object

Selector to select Pod objects.

targetLimit

integer

TargetLimit defines a limit on the number of scraped targets that will be accepted.

.spec.attachMetadata

Description

Attaches node metadata to discovered targets. Only valid for role: pod. Only valid in Prometheus versions 2.35.0 and newer.

Type

object

Property Type Description

node

boolean

When set to true, Prometheus must have permissions to get Nodes.

.spec.namespaceSelector

Description

Selector to select which namespaces the Endpoints objects are discovered from.

Type

object

Property Type Description

any

boolean

Boolean describing whether all namespaces are selected in contrast to a list restricting them.

matchNames

array (string)

List of namespace names to select from.

.spec.podMetricsEndpoints

Description

A list of endpoints allowed as part of this PodMonitor.

Type

array

.spec.podMetricsEndpoints[]

Description

PodMetricsEndpoint defines a scrapeable endpoint of a Kubernetes Pod serving Prometheus metrics.

Type

object

Property Type Description

authorization

object

Authorization section for this endpoint

basicAuth

object

BasicAuth allow an endpoint to authenticate over basic authentication. More info: https://prometheus.io/docs/operating/configuration/#endpoint

bearerTokenSecret

object

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.

followRedirects

boolean

FollowRedirects configures whether scrape requests follow HTTP 3xx redirects.

honorLabels

boolean

HonorLabels chooses the metric’s labels on collisions with target labels.

honorTimestamps

boolean

HonorTimestamps controls whether Prometheus respects the timestamps present in scraped data.

interval

string

Interval at which metrics should be scraped If not specified Prometheus' global scrape interval is used.

metricRelabelings

array

MetricRelabelConfigs to apply to samples before ingestion.

metricRelabelings[]

object

RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. It defines <metric_relabel_configs>-section of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs

oauth2

object

OAuth2 for the URL. Only valid in Prometheus versions 2.27.0 and newer.

params

object

Optional HTTP URL parameters

params{}

array (string)

path

string

HTTP path to scrape for metrics.

port

string

Name of the pod port this endpoint refers to. Mutually exclusive with targetPort.

proxyUrl

string

ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.

relabelings

array

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_config

relabelings[]

object

RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. It defines <metric_relabel_configs>-section of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs

scheme

string

HTTP scheme to use for scraping.

scrapeTimeout

string

Timeout after which the scrape is ended If not specified, the Prometheus global scrape interval is used.

targetPort

integer-or-string

Deprecated: Use 'port' instead.

tlsConfig

object

TLS configuration to use when scraping the endpoint.

.spec.podMetricsEndpoints[].authorization

Description

Authorization section for this endpoint

Type

object

Property Type Description

credentials

object

The secret’s key that contains the credentials of the request

type

string

Set the authentication type. Defaults to Bearer, Basic will cause an error

.spec.podMetricsEndpoints[].authorization.credentials

Description

The secret’s key that contains the credentials of the request

Type

object

Required
  • key

Property Type Description

key

string

The key of the secret to select from. Must be a valid secret key.

name

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?

optional

boolean

Specify whether the Secret or its key must be defined

.spec.podMetricsEndpoints[].basicAuth

Description

BasicAuth allow an endpoint to authenticate over basic authentication. More info: https://prometheus.io/docs/operating/configuration/#endpoint

Type

object

Property Type Description

password

object

The secret in the service monitor namespace that contains the password for authentication.

username

object

The secret in the service monitor namespace that contains the username for authentication.

.spec.podMetricsEndpoints[].basicAuth.password

Description

The secret in the service monitor namespace that contains the password for authentication.

Type

object

Required
  • key

Property Type Description

key

string

The key of the secret to select from. Must be a valid secret key.

name

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?

optional

boolean

Specify whether the Secret or its key must be defined

.spec.podMetricsEndpoints[].basicAuth.username

Description

The secret in the service monitor namespace that contains the username for authentication.

Type

object

Required
  • key

Property Type Description

key

string

The key of the secret to select from. Must be a valid secret key.

name

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?

optional

boolean

Specify whether the Secret or its key must be defined

.spec.podMetricsEndpoints[].bearerTokenSecret

Description

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.

Type

object

Required
  • key

Property Type Description

key

string

The key of the secret to select from. Must be a valid secret key.

name

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?

optional

boolean

Specify whether the Secret or its key must be defined

.spec.podMetricsEndpoints[].metricRelabelings

Description

MetricRelabelConfigs to apply to samples before ingestion.

Type

array

.spec.podMetricsEndpoints[].metricRelabelings[]

Description

RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. It defines <metric_relabel_configs>-section of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs

Type

object

Property Type Description

action

string

Action to perform based on regex matching. Default is 'replace'

modulus

integer

Modulus to take of the hash of the source label values.

regex

string

Regular expression against which the extracted value is matched. Default is '(.*)'

replacement

string

Replacement value against which a regex replace is performed if the regular expression matches. Regex capture groups are available. Default is '$1'

separator

string

Separator placed between concatenated source label values. default is ';'.