Exclude a Sidecar from VPA Using Per-Container Resource Policy
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/nginxlog-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-appto modeAutowithminAllowedcpu100m/ memory128MiandmaxAllowedcpu2/ memory2Gi. - Set
log-sidecarto modeOffto 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.
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.