Vertical and node scaling
Scale at the correct layer
Horizontal scaling adds copies. Vertical scaling changes resource allocations for containers; node autoscaling changes the cluster capacity available to place Pods. Suppose catalog Pods need more memory individually: adding copies may not prevent a single large request from failing. Suppose the HPA requests six Pods but two remain unscheduled because no eligible node has room: investigate scheduling and node capacity. These mechanisms address different constraints and may be used together. None automatically repairs an application bug.
Begin with recommendations, not automatic changes
Vertical Pod Autoscaler (VPA) is an add-on with its own API and controller components. It can estimate CPU and memory requests from usage history and, depending on release and mode, apply recommendations to new or existing Pods. The example uses its v1 API and updateMode Off so it recommends rather than automatically changing resources. The minAllowed and maxAllowed settings bound recommendations for api; they do not prove the workload can operate within that range. The CRD, recommender, supported release and metrics source are prerequisites. Do not install or apply it for this offline exercise.
apiVersion: autoscaling.k8s.io/v1kind: VerticalPodAutoscalermetadata: name: catalog-recommendations namespace: scaling-studyspec: targetRef: apiVersion: apps/v1 kind: Deployment name: catalog updatePolicy: updateMode: "Off" resourcePolicy: containerPolicies: - containerName: api minAllowed: cpu: 100m memory: 64Mi maxAllowed: cpu: 400m memory: 256MiReason about memory and CPU sizing
A container requests 128Mi memory but routinely needs 190Mi and its memory limit is 256Mi. A recommendation of 224Mi may improve placement accounting; it does not by itself increase a limit or guarantee that peaks remain below it. Inspect the proposed request and limit values, memory growth, latency and quota before deciding. Raising a request can prevent a Pod from fitting on a node. Changing requests can also change the denominator of CPU utilization for an HPA. For example, 150m usage divided by 200m request is 75%; the same usage divided by a 300m request is 50%. Avoid independent HPA and VPA control of the same request-relative metric unless the combination is explicitly designed and tested. A recommendation-only VPA is useful for review.
Determine whether extra nodes can help
Node autoscalers such as implementations based on Cluster Autoscaler or Karpenter use scheduling requirements and their configured node choices. If a pending Pod requires 600m CPU and existing eligible nodes have only 400m free each, a new eligible node with sufficient allocatable capacity might help. A new node with only 500m available cannot fit that Pod. Adding nodes cannot fix a rejected API request, an invalid image, an unsupported node label requirement or an impossible storage topology unless the new capacity actually satisfies the constraint. Scale-down/consolidation must consider rescheduling, workload disruption, limits and implementation-specific policy. Node autoscaling is not guaranteed by the presence of HPA.
Diagnose before provisioning
Inspect whether a Pod was admitted, whether it is scheduled and why a scheduling condition is false. A Pod waiting for image download is not the same as a Pod that cannot be scheduled. Use these static read-only command templates only after verifying the isolated lab identity. In a real authorized environment also check the node autoscaler decisions, instance type constraints, quota, available zones and projected cost. Do not query or change a real node pool for this exercise. VPA update mechanisms and in-place resize support are release-specific; confirm both the Kubernetes version and the VPA add-on version before recommending an automatic mode.
kubectl --kubeconfig ./lab.kubeconfig --context scaling-lab -n scaling-study get podskubectl --kubeconfig ./lab.kubeconfig --context scaling-lab -n scaling-study describe pod catalog-examplekubectl --kubeconfig ./lab.kubeconfig --context scaling-lab -n scaling-study get eventsPractice capacity decisions
Open capacity-cases.json. For each situation choose HPA, VPA recommendation review, node capacity review, or a non-scaling fix. Then inspect utilization-cases.json to see how changing a CPU request changes HPA input even when consumption stays constant. Record a minimum and maximum replica and node budget, an escalation path and a rollback plan; a budget alert is not guaranteed to stop charges. The fixtures model only stated constraints, not actual autoscaler decisions.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Vertical and node scaling — knowledge check
Apply autoscaling and disruption concepts to offline scenarios.
A workload is admitted but Pods cannot fit on eligible nodes. Which capacity layer should be investigated?
What does VPA updateMode Off do?
CPU usage stays at 150m; request rises from 200m to 300m. What is the new utilization?
A Pod needs 600m CPU, and a proposed new eligible node has 500m free. Does that CPU capacity suffice?
Which problem should be fixed rather than solved by adding nodes?