.metadata.name — the name of the metric (used in HPA).
.spec.query — a custom PromQL query that returns a unique value for your label set (you can use sum() by() , max() by() , etc., operators for grouping). The following keys must be used in the request:
<<.LabelMatchers>> — will be replaced with a set of {namespace="mynamespace"###PLACEHOLDER###} labels. You can add your own comma-separated labels list (as in the example).
<<.GroupBy>> — will be replaced with namespace###PLACEHOLDER2### labels for grouping (max() by(...) , sum() by (...) , etc.).
|
.metadata.name — имя метрики, используется в HPA.
.spec.query — кастомный PromQL-запрос, который возвращает однозначное значение для вашего набора лейблов (используйте группировку операторами sum() by() , max() by() и пр.). В запросе необходимо обязательно использовать ключи:
<<.LabelMatchers>> — заменится на набор лейблов {namespace="mynamespace"###PLACEHOLDER###} . Можно добавить свои лейблы через запятую (пример).
<<.GroupBy>> — заменится на перечисление лейблов namespace###PLACEHOLDER2### для группировки (max() by(...) , sum() by (...) и пр.).
|
Setting up a vanilla prometheus-metrics-adapter is a time-consuming process. Happily, we have somewhat simplified it by defining a set of CustomResourceDefinitions with different scopes.
| Настройка ванильного prometheus-metrics-adapter — достаточно трудоемкий процесс. Мы его несколько упростили, определив набор CustomResourceDefinition с разной областью видимости (scope).
|
You can globally define a metric using the cluster-wide resource, while the namespaced resource allows you to redefine it locally. All custom resources have the same format.
| С помощью cluster-wide-ресурса можно определить метрику глобально, а с помощью namespaced-ресурса ее можно локально переопределять. Формат всех custom resource’ов — одинаковый.
|
Namespaced custom resources
| Namespaced custom resources
|
ServiceMetric
| ServiceMetric
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,service=”myservice”’ |
replace: ‘###PLACEHOLDER2###’, ‘,service’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,service=”myservice”’ |
replace: ‘###PLACEHOLDER2###’, ‘,service’ }} |
|
IngressMetric
| IngressMetric
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,ingress=”myingress”’ |
replace: ‘###PLACEHOLDER2###’, ‘,ingress’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,ingress=”myingress”’ |
replace: ‘###PLACEHOLDER2###’, ‘,ingress’ }} |
|
PodMetric
| PodMetric
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,pod=”mypod-xxxxx”’ |
replace: ‘###PLACEHOLDER2###’, ‘,pod’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,pod=”mypod-xxxxx”’ |
replace: ‘###PLACEHOLDER2###’, ‘,pod’ }} |
|
DeploymentMetric
| DeploymentMetric
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,deployment=”mydeployment”’ |
replace: ‘###PLACEHOLDER2###’, ‘,deployment’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,deployment=”mydeployment”’ |
replace: ‘###PLACEHOLDER2###’, ‘,deployment’ }} |
|
StatefulSetMetric
| StatefulSetMetric
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,statefulset=”mystatefulset”’ |
replace: ‘###PLACEHOLDER2###’, ‘,statefulset’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,statefulset=”mystatefulset”’ |
replace: ‘###PLACEHOLDER2###’, ‘,statefulset’ }} |
|
NamespaceMetric
| NamespaceMetric
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘’ |
replace: ‘###PLACEHOLDER2###’, ‘’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘’ |
replace: ‘###PLACEHOLDER2###’, ‘’ }} |
|
DaemonSetMetric (not available to users)
| DaemonSetMetric (недоступен пользователям)
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,daemonset=”mydaemonset”’ |
replace: ‘###PLACEHOLDER2###’, ‘,daemonset’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,daemonset=”mydaemonset”’ |
replace: ‘###PLACEHOLDER2###’, ‘,daemonset’ }} |
|
Cluster custom resources
| Cluster custom resources
|
ClusterServiceMetric (not available to users)
| ClusterServiceMetric (недоступен пользователям)
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,service=”myservice”’ |
replace: ‘###PLACEHOLDER2###’, ‘,service’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,service=”myservice”’ |
replace: ‘###PLACEHOLDER2###’, ‘,service’ }} |
|
ClusterIngressMetric (not available to users)
| ClusterIngressMetric (недоступен пользователям)
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,ingress=”myingress”’ |
replace: ‘###PLACEHOLDER2###’, ‘,ingress’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,ingress=”myingress”’ |
replace: ‘###PLACEHOLDER2###’, ‘,ingress’ }} |
|
ClusterPodMetric (not available to users)
| ClusterPodMetric (недоступен пользователям)
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,pod=”mypod-xxxxx”’ |
replace: ‘###PLACEHOLDER2###’, ‘,pod’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,pod=”mypod-xxxxx”’ |
replace: ‘###PLACEHOLDER2###’, ‘,pod’ }} |
|
ClusterDeploymentMetric (not available to users)
| ClusterDeploymentMetric (недоступен пользователям)
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,deployment=”mydeployment”’ |
replace: ‘###PLACEHOLDER2###’, ‘,deployment’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,deployment=”mydeployment”’ |
replace: ‘###PLACEHOLDER2###’, ‘,deployment’ }} |
|
ClusterStatefulSetMetric (not available to users)
| ClusterStatefulSetMetric (недоступен пользователям)
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,statefulset=”mystatefulset”’ |
replace: ‘###PLACEHOLDER2###’, ‘,statefulset’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,statefulset=”mystatefulset”’ |
replace: ‘###PLACEHOLDER2###’, ‘,statefulset’ }} |
|
ClusterDaemonSetMetric (not available to users)
| ClusterDaemonSetMetric (недоступен пользователям)
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,daemonset=”mydaemonset”’ |
replace: ‘###PLACEHOLDER2###’, ‘,daemonset’ }} |
|
{{ cr_spec |
replace: ‘###PLACEHOLDER###’, ‘,daemonset=”mydaemonset”’ |
replace: ‘###PLACEHOLDER2###’, ‘,daemonset’ }} |
|