Skip to content

Commit 89f8110

Browse files
committed
docs(customresourestate): add example to re-expose all VPA metrics
Signed-off-by: clavinjune <[email protected]>
1 parent 1412eaa commit 89f8110

File tree

1 file changed

+210
-0
lines changed

1 file changed

+210
-0
lines changed

docs/metrics/extend/customresourcestate-metrics.md

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,216 @@ spec:
361361

362362
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`).
363363

364+
#### All VerticalPodAutoscaler Metrics
365+
366+
As an addition for the above configuration, here's the complete `CustomResourceStateMetrics` spec to re-enable all of the VPA metrics which are removed from the list of the default resources:
367+
368+
<details>
369+
370+
<summary>VPA CustomResourceStateMetrics</summary>
371+
```yaml
372+
kind: CustomResourceStateMetrics
373+
spec:
374+
resources:
375+
- groupVersionKind:
376+
group: autoscaling.k8s.io
377+
kind: "VerticalPodAutoscaler"
378+
version: "v1"
379+
labelsFromPath:
380+
namespace: [metadata, namespace]
381+
target_api_version: [spec, targetRef, apiVersion]
382+
target_kind: [spec, targetRef, kind]
383+
target_name: [spec, targetRef, name]
384+
verticalpodautoscaler: [metadata, name]
385+
metricNamePrefix: "kube"
386+
metrics:
387+
# kube_verticalpodautoscaler_annotations
388+
- name: "verticalpodautoscaler_annotations"
389+
help: "Kubernetes annotations converted to Prometheus labels."
390+
each:
391+
type: Info
392+
info:
393+
labelsFromPath:
394+
# annotation_*: [metadata, annotations]
395+
name: [metadata, name]
396+
# kube_verticalpodautoscaler_labels
397+
- name: "verticalpodautoscaler_labels"
398+
help: "Kubernetes labels converted to Prometheus labels."
399+
each:
400+
type: Info
401+
info:
402+
labelsFromPath:
403+
# label_*: [metadata, labels]
404+
name: [metadata, name]
405+
# kube_verticalpodautoscaler_spec_updatepolicy_updatemode
406+
- name: "verticalpodautoscaler_spec_updatepolicy_updatemode"
407+
help: "Update mode of the VerticalPodAutoscaler."
408+
each:
409+
type: StateSet
410+
stateSet:
411+
labelName: "update_mode"
412+
path: [spec, updatePolicy, updateMode]
413+
list: ["Auto", "Initial", "Off", "Recreate"]
414+
# Memory kube_verticalpodautoscaler_spec_resourcepolicy_container_policies_minallowed
415+
- name: "verticalpodautoscaler_spec_resourcepolicy_container_policies_minallowed"
416+
help: "Minimum memory resources the VerticalPodAutoscaler can set for containers matching the name."
417+
commonLabels:
418+
unit: "byte"
419+
resource: "memory"
420+
each:
421+
type: Gauge
422+
gauge:
423+
path: [spec, resourcePolicy, containerPolicies]
424+
labelsFromPath:
425+
container: [containerName]
426+
valueFrom: [minAllowed, memory]
427+
# CPU kube_verticalpodautoscaler_spec_resourcepolicy_container_policies_minallowed
428+
- name: "verticalpodautoscaler_spec_resourcepolicy_container_policies_minallowed"
429+
help: "Minimum cpu resources the VerticalPodAutoscaler can set for containers matching the name."
430+
commonLabels:
431+
unit: "core"
432+
resource: "cpu"
433+
each:
434+
type: Gauge
435+
gauge:
436+
path: [spec, resourcePolicy, containerPolicies]
437+
labelsFromPath:
438+
container: [containerName]
439+
valueFrom: [minAllowed, cpu]
440+
# Memory kube_verticalpodautoscaler_spec_resourcepolicy_container_policies_maxallowed
441+
- name: "verticalpodautoscaler_spec_resourcepolicy_container_policies_maxallowed"
442+
help: "Maximum memory resources the VerticalPodAutoscaler can set for containers matching the name."
443+
commonLabels:
444+
unit: "byte"
445+
resource: "memory"
446+
each:
447+
type: Gauge
448+
gauge:
449+
path: [spec, resourcePolicy, containerPolicies]
450+
labelsFromPath:
451+
container: [containerName]
452+
valueFrom: [maxAllowed, memory]
453+
# CPU kube_verticalpodautoscaler_spec_resourcepolicy_container_policies_maxallowed
454+
- name: "verticalpodautoscaler_spec_resourcepolicy_container_policies_maxallowed"
455+
help: "Maximum cpu resources the VerticalPodAutoscaler can set for containers matching the name."
456+
commonLabels:
457+
unit: "core"
458+
resource: "cpu"
459+
each:
460+
type: Gauge
461+
gauge:
462+
path: [spec, resourcePolicy, containerPolicies]
463+
labelsFromPath:
464+
container: [containerName]
465+
valueFrom: [maxAllowed, cpu]
466+
# Memory kube_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound
467+
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound"
468+
help: "Minimum memory resources the container can use before the VerticalPodAutoscaler updater evicts it."
469+
commonLabels:
470+
unit: "byte"
471+
resource: "memory"
472+
each:
473+
type: Gauge
474+
gauge:
475+
path: [status, recommendation, containerRecommendations]
476+
labelsFromPath:
477+
container: [containerName]
478+
valueFrom: [lowerBound, memory]
479+
# CPU kube_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound
480+
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound"
481+
help: "Minimum cpu resources the container can use before the VerticalPodAutoscaler updater evicts it."
482+
commonLabels:
483+
unit: "core"
484+
resource: "cpu"
485+
each:
486+
type: Gauge
487+
gauge:
488+
path: [status, recommendation, containerRecommendations]
489+
labelsFromPath:
490+
container: [containerName]
491+
valueFrom: [lowerBound, cpu]
492+
# Memory kube_verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound
493+
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound"
494+
help: "Maximum memory resources the container can use before the VerticalPodAutoscaler updater evicts it."
495+
commonLabels:
496+
unit: "byte"
497+
resource: "memory"
498+
each:
499+
type: Gauge
500+
gauge:
501+
path: [status, recommendation, containerRecommendations]
502+
labelsFromPath:
503+
container: [containerName]
504+
valueFrom: [upperBound, memory]
505+
# CPU kube_verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound
506+
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound"
507+
help: "Maximum cpu resources the container can use before the VerticalPodAutoscaler updater evicts it."
508+
commonLabels:
509+
unit: "core"
510+
resource: "cpu"
511+
each:
512+
type: Gauge
513+
gauge:
514+
path: [status, recommendation, containerRecommendations]
515+
labelsFromPath:
516+
container: [containerName]
517+
valueFrom: [upperBound, cpu]
518+
# Memory kube_verticalpodautoscaler_status_recommendation_containerrecommendations_target
519+
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_target"
520+
help: "Target memory resources the VerticalPodAutoscaler recommends for the container."
521+
commonLabels:
522+
unit: "byte"
523+
resource: "memory"
524+
each:
525+
type: Gauge
526+
gauge:
527+
path: [status, recommendation, containerRecommendations]
528+
labelsFromPath:
529+
container: [containerName]
530+
valueFrom: [target, memory]
531+
# CPU kube_verticalpodautoscaler_status_recommendation_containerrecommendations_target
532+
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_target"
533+
help: "Target cpu resources the VerticalPodAutoscaler recommends for the container."
534+
commonLabels:
535+
unit: "core"
536+
resource: "cpu"
537+
each:
538+
type: Gauge
539+
gauge:
540+
path: [status, recommendation, containerRecommendations]
541+
labelsFromPath:
542+
container: [containerName]
543+
valueFrom: [target, cpu]
544+
# Memory kube_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget
545+
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget"
546+
help: "Target memory resources the VerticalPodAutoscaler recommends for the container ignoring bounds."
547+
commonLabels:
548+
unit: "byte"
549+
resource: "memory"
550+
each:
551+
type: Gauge
552+
gauge:
553+
path: [status, recommendation, containerRecommendations]
554+
labelsFromPath:
555+
container: [containerName]
556+
valueFrom: [uncappedTarget, memory]
557+
# CPU kube_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget
558+
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget"
559+
help: "Target memory resources the VerticalPodAutoscaler recommends for the container ignoring bounds."
560+
commonLabels:
561+
unit: "core"
562+
resource: "cpu"
563+
each:
564+
type: Gauge
565+
gauge:
566+
path: [status, recommendation, containerRecommendations]
567+
labelsFromPath:
568+
container: [containerName]
569+
valueFrom: [uncappedTarget, cpu]
570+
```
571+
572+
<details>
573+
364574
### Metric types
365575

366576
The configuration supports three kind of metrics from the [OpenMetrics specification](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md).

0 commit comments

Comments
 (0)