- Deploy a sample application.
- Monitor CPU utilization.
- Apply a VPA that produces recommendations (no automatic updates).
- Run a CPU load test and validate VPA recommendations.

- A simple Flask application will act as the CPU workload for this lab.
- Initially the app is idle and uses very little CPU (typically ~1m).
- A VPA will be created to produce CPU recommendations only (no automatic updates). The VPA will enforce a minimum of
100mand a maximum of1000mCPU for the container and will be configured to control CPU only.
Apply the VPA
- With the app idle, the VPA typically recommends something near the configured minimum (100m) because current observed CPU usage is very low (≈1m).
- After generating CPU load against the Flask app, re-check the VPA recommendations. In this lab the recommendation rose from
100mup to about126m, tracking the increased observed CPU usage while respecting the configuredminAllowedandmaxAllowedbounds.
- Check pod CPU usage:
kubectl top pods
- Check VPA status and recommendations:
kubectl describe vpa flask-appkubectl get vpa flask-app -o yaml
Millicore reminder: 1 CPU = 1000m. So
100m = 0.1 CPU and 126m ≈ 0.126 CPU.Caution when using
updateMode: "Auto": automatic updates may restart pods to change requests. Use Auto in production only after validating recommendations and testing rollout behavior.- Deploy the Flask test application (Deployment + Service).
- Observe current CPU usage (e.g.,
kubectl top pods) — idle pods often show ~1m. - Create the VPA manifest (
vpa-cpu.yml) and apply it:kubectl apply -f vpa-cpu.yml
- Inspect VPA recommendations while the app is idle:
kubectl describe vpa flask-app- Recommendations will typically be near the configured
minAllowed.
- Run a short CPU load test against the Flask service (tool of your choice).
- Re-inspect the VPA recommendations and confirm they increased (e.g., from
100mto ~126m), staying within100m–1000m.
- The VPA only recommends values when
updateMode: "Off". To have the VPA apply changes automatically, setupdateModeto"Auto". - VPA recommendations are based on observed usage over time — brief spikes may not immediately alter recommendations.
- Use
kubectl describe vpa <name>to see summary recommendation information and any events.