Inspect VPA Recommendations in Off Mode · Kubernetes
Separate measured usage, recommended resources, and current requests before automation.
Learn with progress and quizzesFirst, understand the concepts.
VPA is an additional component
VPA is not installed automatically with Kubernetes. It requires CRDs, a recommender, and usage metrics; automatic modes involve updater or admission-controller behavior as well. CRD presence alone does not establish a working recommendation pipeline.
Observe with Off
Off records recommendations in status without automatically changing Pod resources. target and bounds depend on observations and workload history. Short idle-lab recommendations are not production sizing decisions.
Application modes and disruption
Initial applies at creation; Recreate applies through replacement. Check installed VPA and Kubernetes support for modes such as InPlaceOrRecreate and their disruption behavior. Consider PodDisruptionBudgets, capacity, and application availability before automation.
Interaction with HPA
VPA changes resource requests while HPA changes replicas. CPU-utilization HPA uses requests as its denominator, so modifying the same resource through VPA couples the controllers. Design their combination, such as observation-only VPA or different scaling metrics.
Why it matters
A VPA recommendation informs an operational decision based on observed use. A few idle minutes do not represent production peaks, batch activity, or memory leaks.
Work through the reasoning
Compare three types of values
kubectl top reports current usage, VPA status recommends resources, and Pod spec shows applied requests. In Off, first verify recommendations leave spec unchanged. Policy bounds do not create node capacity.
Ask before automation
Choose containers and resources, acceptable resize or replacement behavior, disruption budgets, and required capacity. If HPA scales on CPU utilization, evaluate how changing requests alters that calculation.
Learn by doing.
Use kubectl, a personal practice Kubernetes cluster, and a POSIX shell. cert-manager and VPA labs require the components specified in each lesson. Node-changing labs require a dedicated disposable worker. Use the practice namespaces.
Use a personal cluster with VPA CRDs and recommender plus metrics-server or a supported metric source. Check version-specific setup in the official quickstart. This lab disables application of recommendations and specifies resource bounds. If no recommendation appears within five minutes, inspect conditions, recommender logs, and the metrics API.
(
set -eu
kubectl config current-context
kubectl get crd verticalpodautoscalers.autoscaling.k8s.io
kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes >/dev/null
kubectl create namespace study-vpa --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n study-vpa -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata:
name: worker
spec:
replicas: 1
selector:
matchLabels: {app: vpa-worker}
template:
metadata:
labels: {app: vpa-worker}
spec:
containers:
- name: worker
image: busybox:1.36
command: ["sh", "-c", "while true; do sleep 1; done"]
resources:
requests: {cpu: 50m, memory: 32Mi}
limits: {cpu: 500m, memory: 256Mi}
---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: worker
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: worker
updatePolicy:
updateMode: "Off"
resourcePolicy:
containerPolicies:
- containerName: worker
controlledResources: [cpu, memory]
controlledValues: RequestsOnly
minAllowed: {cpu: 25m, memory: 32Mi}
maxAllowed: {cpu: 250m, memory: 128Mi}
YAML
kubectl rollout status deployment/worker -n study-vpa --timeout=120s
kubectl wait -n study-vpa --for=jsonpath='{.status.recommendation.containerRecommendations[0].target.cpu}' vpa/worker --timeout=300s
kubectl get vpa worker -n study-vpa -o yaml
kubectl top pods -n study-vpa
kubectl get pods -n study-vpa -l app=vpa-worker -o jsonpath='{range .items[*]}{.spec.containers[0].resources.requests}{"\n"}{end}'
kubectl get deployment worker -n study-vpa -o jsonpath='{.spec.template.spec.containers[0].resources.requests}{"\n"}'
)How to check your result
Read the worker target, lowerBound, and upperBound under status.recommendation.containerRecommendations; values vary by environment. Actual Pod and Deployment requests should remain 50m/32Mi in Off mode. Distinguish measured usage, recommended values, and declared requests.
Clean up practice resources
Run after checking the result. Confirm these resources belong to your practice run and contain no data you need to keep.
kubectl delete namespace study-vpaApply what you learned
VPA recommends 200m but the Pod still requests 50m. Does that prove a failure?
Reveal the reasoning after trying
Check updateMode first. Off intentionally leaves requests unchanged. For automated application, review supported modes, admission/updater setup, availability, PDBs, and capacity before changing the mode.
Ready to check your understanding?
In Off mode, VPA recommends more CPU than the current request. What happens?
- Every Pod immediately restarts
- The recommendation is recorded without automatic application
- Node CPUs are automatically expanded
- HPA is necessarily disabled
Reveal the reasoning after trying
The recommendation is recorded without automatic application
Off provides recommendations without applying them. Review workload representativeness, bounds, node capacity, and HPA interactions before making changes.
Official documentation · Inspect VPA Recommendations in Off Mode · VPA installation · official quickstart