Challenge
DifficultyMedium
Learner activity36 solved of 42 attempts

Exclude a Sidecar from VPA Using Per-Container Resource Policy

Configure a Vertical Pod Autoscaler (VPA) with a per-container resource policy that provides recommendations for the main container while excluding the sidecar container from any VPA-managed scaling.

Scenario

A Deployment web-app is running in the production namespace with 2 replicas. Each pod runs two containers that share a log volume:

  • main-app — an nginx web server serving traffic and writing access logs to a shared volume at /var/log/nginx
  • log-sidecar — a busybox container that tails the shared log volume and ships logs, with stable and manually tuned resource values

The team wants to introduce a Vertical Pod Autoscaler (VPA) to generate right-sizing recommendations for main-app. The log-sidecar has fixed resource values that must not be touched — it must be excluded from VPA entirely.


Task

Create a VPA named web-app-vpa in the production namespace targeting the web-app Deployment with updateMode: Off.

Configure resourcePolicy.containerPolicies for each container:

  • Set main-app to mode Auto with minAllowed cpu 100m / memory 128Mi and maxAllowed cpu 2 / memory 2Gi.
  • Set log-sidecar to mode Off to exclude it from VPA recommendations.

After creating the VPA, wait a few minutes and verify that recommendations appear only for main-app and not for log-sidecar.

Important

Do not modify the Deployment resource requests or limits. This challenge is only about creating the VPA with the correct per-container policy.


Hint

A VPA resourcePolicy allows you to control behavior per container using containerName and mode. Setting mode: Off on a container tells VPA to skip it entirely. Use minAllowed and maxAllowed to bound the recommendation range for containers you want VPA to manage.


Test Cases

Problem
Solution
Start
Black Friday 2026