kubernetes autoscaling ai_generated true

unable to calculate desired number of replicas: missing request for cpu

ID: kubernetes/horizontal-pod-autoscaler-unable

Also available as: JSON · Markdown
94%Fix Rate
96%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
8 active
8 active

Root Cause

HPA cannot scale because pods don't have CPU/memory resource requests defined.

generic

Workarounds

  1. 96% success Add resource requests to the pod spec: resources.requests.cpu: 100m
    HPA needs resource requests to calculate utilization percentage

    Sources: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/

  2. 88% success Use metrics-server to verify metrics are available: kubectl top pods
    HPA requires metrics-server to be installed and running

Dead Ends

Common approaches that don't work:

  1. Setting arbitrary resource requests 55% fail

    Over or under-provisioning; either wastes resources or causes OOM

  2. Using memory-based scaling instead 55% fail

    Memory scaling is less responsive than CPU for most workloads

Error Chain

Frequently confused with: