In this lesson, you will learn how to leverage the Vertical Pod Autoscaler (VPA) in Recommendation mode to identify optimal resource requests for workloads with highly volatile or unpredictable consumption profiles.
The Challenge of Static Requests
In production, we often face a dilemma with pods that have unpredictable traffic or batch-processing bursts. If you define static requests too low, your pods risk eviction or throttling; if you set them too high, you suffer from "stranded resources," where your cluster nodes are underutilized, inflating your infrastructure costs. While Horizontal Pod Autoscaler (HPA) helps with scaling replicas, it doesn't solve the problem of selecting the "correct" baseline size for the individual pod.
Leveraging VPA in Recommendation Mode
The VPA component includes a Recommender that observes actual usage metrics over time. By deploying the VPA in updateMode: "Off" (also known as Recommendation mode), you can benefit from its intelligence without allowing it to automatically restart your pods.
In this mode, VPA analyzes the resource usage patterns—including peaks and troughs—and generates a recommendation in the pod's status. You can inspect these recommendations using kubectl:
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: unstable-workload-vpa
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: unstable-workload
updatePolicy:
updateMode: "Off"
Once the controller has collected enough data, you can view the calculated recommended values via:
kubectl get vpa unstable-workload-vpa -o yaml
Operationalizing Insights
The Recommendation mode acts as an automated "sizing assistant." Instead of guessing your resource requests or relying on manual capacity forecasting, you can treat these outputs as data-driven evidence. When you notice a trend in the VPA recommendations—such as a consistent gap between your current request and the suggested amount—you can update your declarative configuration files (following your Infrastructure as Code patterns) to align with the actual usage. This allows you to fine-tune your footprint iteratively without risking unexpected pod restarts in production.
Key Takeaway: Use VPA in Recommendation mode to gain empirical insights into workload behavior, allowing you to optimize resource requests precisely and minimize cluster waste without automating disruptive pod restarts.