Skip to content

Commit cef8c1f

Browse files
committed
feat!: Remove VerticalPodAutoscaler
BREAKING CHANGE: VPA is now supported only via Custom Resource Metrics Signed-off-by: Manuel Rüger <[email protected]>
1 parent a577a59 commit cef8c1f

File tree

13 files changed

+54
-732
lines changed

13 files changed

+54
-732
lines changed

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ are deleted they are no longer visible on the `/metrics` endpoint.
3737
- [Container Image](#container-image)
3838
- [Metrics Documentation](#metrics-documentation)
3939
- [Conflict resolution in label names](#conflict-resolution-in-label-names)
40-
- [Enabling VerticalPodAutoscalers](#enabling-verticalpodautoscalers)
4140
- [Kube-state-metrics self metrics](#kube-state-metrics-self-metrics)
4241
- [Resource recommendation](#resource-recommendation)
4342
- [Latency](#latency)
@@ -123,13 +122,6 @@ e.g. by standardizing Kubernetes labels using an
123122
[Admission Webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/)
124123
that ensures that there are no possible conflicts.
125124

126-
#### Enabling VerticalPodAutoscalers
127-
128-
Please note that the collector for `verticalpodautoscalers` is **disabled** by default; Vertical Pod Autoscaler metrics will not be collected until the collector is enabled. This is because Vertical Pod Autoscalers are managed as custom resources.
129-
130-
If you want to enable this collector,
131-
the [instructions](./docs/verticalpodautoscaler-metrics.md#Configuration) are located in the [Vertical Pod Autoscaler Metrics](./docs/verticalpodautoscaler-metrics.md) documentation.
132-
133125
### Kube-state-metrics self metrics
134126

135127
kube-state-metrics exposes its own general process metrics under `--telemetry-host` and `--telemetry-port` (default 8081).

docs/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ See each file for specific documentation about the exposed metrics:
7070
- [Role Metrics](role-metrics.md)
7171
- [RoleBinding Metrics](rolebinding-metrics.md)
7272
- [ServiceAccount Metrics](serviceaccount-metrics.md)
73-
- [VerticalPodAutoscaler Metrics](verticalpodautoscaler-metrics.md)
7473

7574
## Join Metrics
7675

docs/customresourcestate-metrics.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ spec:
4646
each:
4747
type: Gauge
4848
...
49-
- --resources=certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,foos,horizontalpodautoscalers,ingresses,jobs,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments,verticalpodautoscalers
49+
- --resources=certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,foos,horizontalpodautoscalers,ingresses,jobs,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments
5050
```
5151
5252
It's also possible to configure kube-state-metrics to run in a `custom-resource-mode` only. In addition to specifying one of `--custom-resource-state-config*` flags, you could set `--custom-resource-state-only` to `true`.
@@ -207,6 +207,45 @@ kube_customresource_ready_count{customresource_group="myteam.io", customresource
207207
kube_customresource_ready_count{customresource_group="myteam.io", customresource_kind="Foo", customresource_version="v1", active="3",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-b"} 4
208208
```
209209

210+
#### VerticalPodAutoscaler
211+
212+
In v2.9.0 the `vericalpodautoscalers` resource was removed from the list of default resources. In order to generate metrics for `verticalpodautoscalers`, you can use the following Custom Resource State config:
213+
214+
```yaml
215+
# Using --resource=verticalpodautoscalers, we get the following output:
216+
# HELP kube_verticalpodautoscaler_annotations Kubernetes annotations converted to Prometheus labels.
217+
# TYPE kube_verticalpodautoscaler_annotations gauge
218+
# kube_verticalpodautoscaler_annotations{namespace="default",verticalpodautoscaler="hamster-vpa",target_api_version="apps/v1",target_kind="Deployment",target_name="hamster"} 1
219+
# A similar result can be achieved by specifying the following in --custom-resource-state-config:
220+
kind: CustomResourceStateMetrics
221+
spec:
222+
resources:
223+
- groupVersionKind:
224+
group: autoscaling.k8s.io
225+
kind: "VerticalPodAutoscaler"
226+
version: "v1"
227+
labelsFromPath:
228+
verticalpodautoscaler: [metadata, name]
229+
namespace: [metadata, namespace]
230+
target_api_version: [apiVersion]
231+
target_kind: [spec, targetRef, kind]
232+
target_name: [spec, targetRef, name]
233+
metrics:
234+
- name: "annotations"
235+
help: "Kubernetes annotations converted to Prometheus labels."
236+
each:
237+
type: Gauge
238+
gauge:
239+
path: [metadata, annotations]
240+
# This will output the following metric:
241+
# HELP kube_customresource_autoscaling_annotations Kubernetes annotations converted to Prometheus labels.
242+
# TYPE kube_customresource_autoscaling_annotations gauge
243+
# kube_customresource_autoscaling_annotations{customresource_group="autoscaling.k8s.io", customresource_kind="VerticalPodAutoscaler", customresource_version="v1", namespace="default",target_api_version="autoscaling.k8s.io/v1",target_kind="Deployment",target_name="hamster",verticalpodautoscaler="hamster-vpa"} 123
244+
```
245+
246+
The above configuration was tested on [this](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/examples/hamster.yaml) VPA configuration, with an added annotation (`foo: 123`).
247+
248+
210249
### Metric types
211250

212251
The configuration supports three kind of metrics from the [OpenMetrics specification](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md).

docs/verticalpodautoscaler-metrics.md

Lines changed: 0 additions & 145 deletions
This file was deleted.

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ require (
1717
gopkg.in/yaml.v3 v3.0.1
1818
k8s.io/api v0.26.2
1919
k8s.io/apimachinery v0.26.2
20-
k8s.io/autoscaler/vertical-pod-autoscaler v0.13.0
2120
k8s.io/client-go v0.26.2
2221
k8s.io/component-base v0.26.2
2322
k8s.io/klog/v2 v2.90.1

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,6 @@ k8s.io/api v0.26.2 h1:dM3cinp3PGB6asOySalOZxEG4CZ0IAdJsrYZXE/ovGQ=
607607
k8s.io/api v0.26.2/go.mod h1:1kjMQsFE+QHPfskEcVNgL3+Hp88B80uj0QtSOlj8itU=
608608
k8s.io/apimachinery v0.26.2 h1:da1u3D5wfR5u2RpLhE/ZtZS2P7QvDgLZTi9wrNZl/tQ=
609609
k8s.io/apimachinery v0.26.2/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I=
610-
k8s.io/autoscaler/vertical-pod-autoscaler v0.13.0 h1:pH6AsxeBZcyX6KBqcnl7SPIJqbN1d59RrEBuIE6Rq6c=
611-
k8s.io/autoscaler/vertical-pod-autoscaler v0.13.0/go.mod h1:LraL5kR2xX7jb4VMCG6/tUH4I75uRHlnzC0VWQHcyWk=
612610
k8s.io/client-go v0.26.2 h1:s1WkVujHX3kTp4Zn4yGNFK+dlDXy1bAAkIl+cFAiuYI=
613611
k8s.io/client-go v0.26.2/go.mod h1:u5EjOuSyBa09yqqyY7m3abZeovO/7D/WehVVlZ2qcqU=
614612
k8s.io/component-base v0.26.2 h1:IfWgCGUDzrD6wLLgXEstJKYZKAFS2kO+rBRi0p3LqcI=

0 commit comments

Comments
 (0)