Panfactum LogoPanfactum
Infrastructure ModulesDirect ModulesKuberneteskube_vpa
kube_vpa
Stable
Direct
Source Code Link

Kubernetes VPA

This module provides a deployment of the vertical-pod-autoscaler project.

Usage

Metrics History

Set history_length_hours to the number of hours of historical metrics that you want to use for the initial VPA recommendations.

Metrics are weighted based on an exponential decay algorithm so more recent data will be weighted more heavily than older data. Metrics older than history_length_hours will no longer impact calculations.

If using Prometheus, 100 samples will be taken from this range in order to seed the internal VPA database. Do not set history_length_hours to greater than 1 week as this will cause significant strain on the Prometheus instance.

Using the Prometheus Backend

Alpha Quality: Do not use

The VPA can use Prometheus as the source of its recommendations when setting pod resources. To enable this in the Panfactum stack:

  • Ensure you have deployed kube_monitoring. Note that kube_monitoring must have been deployed for at least history_length_hours in order for the VPA to work properly.

  • Set prometheus_enabled to true.

  • Add the thanos_query_frontend_url input from the kube_monitoring output.

  • Apply the module.

  • If you had previously deployed the VPA without Prometheus, delete all Verticalpodautoscalercheckpoints: kubectl delete -A verticalpodautoscalercheckpoints.autoscaling.k8s.io --all.

Providers

The following providers are needed by this module:

  • aws (5.39.1)

  • helm (2.12.1)

  • kubectl (2.0.4)

  • kubernetes (2.27.0)

Required Inputs

No required inputs.

Optional Inputs

The following input variables are optional (have default values):

enhanced_ha_enabled

Description: Whether to add extra high-availability scheduling constraints at the trade-off of increased cost

Type: bool

Default: true

history_length_hours

Description: The number of prior hours of metrics data that will be used for VPA recommendations

Type: number

Default: 24

log_verbosity

Description: The log verbosity (0-9) for the VPA pods

Type: number

Default: 0

monitoring_enabled

Description: Whether to allow monitoring CRs to be deployed in the namespace

Type: bool

Default: true

panfactum_scheduler_enabled

Description: Whether to use the Panfactum pod scheduler with enhanced bin-packing

Type: bool

Default: false

prometheus_enabled

Description: Whether to enable prometheus as the storage backend for the VPA recommender

Type: bool

Default: false

pull_through_cache_enabled

Description: Whether to use the ECR pull through cache for the deployed images

Type: bool

Default: true

thanos_query_frontend_url

Description: The address of the thanos query frontend to be used by the VPA recommender

Type: string

Default: null

vertical_autoscaler_helm_version

Description: The version of VPA helm chart to deploy

Type: string

Default: "4.4.6"

vertical_autoscaler_image_version

Description: The version of VPA image deploy

Type: string

Default: "1.1.1"

vpa_enabled

Description: Whether the VPA resources should be enabled

Type: bool

Default: false

Outputs

No outputs.

Usage

No notes