mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
Demonstrate how to use external metrics
This commit is contained in:
parent
4b5788e847
commit
936bda2ef0
4 changed files with 52 additions and 2 deletions
|
|
@ -3,8 +3,9 @@
|
||||||
[](https://travis-ci.org/DirectXMan12/k8s-prometheus-adapter)
|
[](https://travis-ci.org/DirectXMan12/k8s-prometheus-adapter)
|
||||||
|
|
||||||
This repository contains an implementation of the Kubernetes
|
This repository contains an implementation of the Kubernetes
|
||||||
[resource metrics](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/resource-metrics-api.md) API and
|
[resource metrics](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/resource-metrics-api.md),
|
||||||
[custom metrics](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/custom-metrics-api.md) API.
|
[custom metrics](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/custom-metrics-api.md), and
|
||||||
|
[external metrics](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/external-metrics-api.md) APIs.
|
||||||
|
|
||||||
This adapter is therefore suitable for use with the autoscaling/v2 Horizontal Pod Autoscaler in Kubernetes 1.6+.
|
This adapter is therefore suitable for use with the autoscaling/v2 Horizontal Pod Autoscaler in Kubernetes 1.6+.
|
||||||
It can also replace the [metrics server](https://github.com/kubernetes-incubator/metrics-server) on clusters that already run Prometheus and collect the appropriate metrics.
|
It can also replace the [metrics server](https://github.com/kubernetes-incubator/metrics-server) on clusters that already run Prometheus and collect the appropriate metrics.
|
||||||
|
|
|
||||||
|
|
@ -11,3 +11,32 @@ spec:
|
||||||
insecureSkipTLSVerify: true
|
insecureSkipTLSVerify: true
|
||||||
groupPriorityMinimum: 100
|
groupPriorityMinimum: 100
|
||||||
versionPriority: 100
|
versionPriority: 100
|
||||||
|
---
|
||||||
|
apiVersion: apiregistration.k8s.io/v1beta1
|
||||||
|
kind: APIService
|
||||||
|
metadata:
|
||||||
|
name: v1beta2.custom.metrics.k8s.io
|
||||||
|
spec:
|
||||||
|
service:
|
||||||
|
name: custom-metrics-apiserver
|
||||||
|
namespace: custom-metrics
|
||||||
|
group: custom.metrics.k8s.io
|
||||||
|
version: v1beta2
|
||||||
|
insecureSkipTLSVerify: true
|
||||||
|
groupPriorityMinimum: 100
|
||||||
|
versionPriority: 200
|
||||||
|
---
|
||||||
|
apiVersion: apiregistration.k8s.io/v1beta1
|
||||||
|
kind: APIService
|
||||||
|
metadata:
|
||||||
|
name: v1beta1.external.metrics.k8s.io
|
||||||
|
spec:
|
||||||
|
service:
|
||||||
|
name: custom-metrics-apiserver
|
||||||
|
namespace: custom-metrics
|
||||||
|
group: external.metrics.k8s.io
|
||||||
|
version: v1beta1
|
||||||
|
insecureSkipTLSVerify: true
|
||||||
|
groupPriorityMinimum: 100
|
||||||
|
versionPriority: 100
|
||||||
|
---
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@ metadata:
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- custom.metrics.k8s.io
|
- custom.metrics.k8s.io
|
||||||
|
- external.metrics.k8s.io
|
||||||
resources: ["*"]
|
resources: ["*"]
|
||||||
verbs: ["*"]
|
verbs: ["*"]
|
||||||
|
|
|
||||||
|
|
@ -96,3 +96,22 @@ data:
|
||||||
resource: pod
|
resource: pod
|
||||||
containerLabel: container_name
|
containerLabel: container_name
|
||||||
window: 1m
|
window: 1m
|
||||||
|
externalRules:
|
||||||
|
- seriesQuery: '{__name__=~"^.*_queue_(length|size)$",namespace!=""}'
|
||||||
|
resources:
|
||||||
|
overrides:
|
||||||
|
namespace:
|
||||||
|
resource: namespace
|
||||||
|
name:
|
||||||
|
matches: ^.*_queue_(length|size)$
|
||||||
|
as: "$0"
|
||||||
|
metricsQuery: max(<<.Series>>{<<.LabelMatchers>>})
|
||||||
|
- seriesQuery: '{__name__=~"^.*_queue$",namespace!=""}'
|
||||||
|
resources:
|
||||||
|
overrides:
|
||||||
|
namespace:
|
||||||
|
resource: namespace
|
||||||
|
name:
|
||||||
|
matches: ^.*_queue$
|
||||||
|
as: "$0"
|
||||||
|
metricsQuery: max(<<.Series>>{<<.LabelMatchers>>})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue