How to fix missing request for cpu in container in Kubernetes

KubernetesINTERMEDIATEHIGHUpdated Dec 5, 2025· 194 views

The Horizontal Pod Autoscaler cannot compute scaling decisions because containers are missing CPU resource requests. HPA calculates utilization as (current_usage / requested_resources), making resource requests mandatory.

Quick fix

Fixes missing request for cpu in container

kubectl describe hpa <hpa-name> -n <namespace>
  1. Verify HPA status and check the error messages
  2. Check if Metrics Server is running
  3. Identify all containers in the target deployment
  4. Add CPU resource requests to your deployment
kubernetes — error
kubectl describe hpa <hpa-name> -n <namespace>
missing request for cpu in container

What this error means

The Horizontal Pod Autoscaler (HPA) cannot compute scaling decisions because one or more containers in your pods are missing CPU resource requests in their specification. HPA calculates utilization as a percentage by dividing the current CPU usage by the requested CPU amount (utilization = current_usage / requested_resources). Without a defined CPU request, this calculation is impossible, and the HPA cannot determine whether to scale up or down. This error typically appears as 'FailedGetResourceMetric' events on your HPA object, with messages like 'the HPA was unable to compute the replica count: failed to get cpu utilization: missing request for cpu'. The HPA controller requires CPU requests to be specified on every container in every pod that it manages, including sidecar containers that may be automatically injected by service meshes like Istio or Linkerd.

Typical symptoms

  • HPA events show "Warning FailedGetResourceMetric missing request for cpu"
  • kubectl describe hpa shows "Current CPU" as "<unknown>" or "N/A"
  • Deployments do not scale up or down despite high or low CPU usage
  • HPA remains at minimum replicas even under heavy load
  • Metrics Server can retrieve node metrics (kubectl top nodes works) but pod metrics fail
  • Events log shows "the HPA was unable to compute the replica count"

Common causes

  1. Container spec is missing the resources.requests.cpu field entirely
  2. Resources block is overwritten or duplicated in the YAML manifest, clearing the first definition
  3. Sidecar containers injected by service meshes (Istio, Linkerd) lack resource requests
  4. All containers in a pod must have resource requests; even one container without them blocks HPA
  5. Metrics Server is not installed or not running in the cluster
  6. RBAC permissions are incorrectly configured, blocking HPA from accessing resource metrics API
  7. Using autoscaling/v1 with targetCPUUtilizationPercentage without proper resource specifications

How to fix "missing request for cpu in container"

1Verify HPA status and check the error messages

Describe the HPA resource to see the exact error:

bash
kubectl describe hpa <hpa-name> -n <namespace>

Look for 'Warning' events mentioning 'FailedGetResourceMetric' or 'missing request for cpu'. Note the target deployment/statefulset name.

2Check if Metrics Server is running

The Metrics Server must be installed for HPA to retrieve CPU metrics:

bash
kubectl get deployment metrics-server -n kube-system
kubectl top nodes  # Should return CPU/memory data
kubectl top pods -n <namespace>  # Should return pod metrics

If metrics-server is missing, install it:

bash
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
3Identify all containers in the target deployment

List all containers, including any sidecar containers that may be auto-injected:

bash
kubectl get deployment <deployment-name> -n <namespace> -o yaml | grep -A 5 'containers:'

Service meshes (Istio, Linkerd) may inject sidecars automatically. Check:

bash
kubectl describe deployment <deployment-name> -n <namespace>

Look at the 'Containers' section to see all container names, including injected ones.

4Add CPU resource requests to your deployment

Update your Deployment manifest to include resource requests for all containers:

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  template:
    spec:
      containers:
      - name: my-app
        image: my-app:latest
        resources:
          requests:
            cpu: "250m"      # Required for HPA CPU-based scaling
            memory: "64Mi"
          limits:
            cpu: "500m"
            memory: "128Mi"

Choose appropriate values based on your application's typical usage (e.g., 250m = 0.25 CPU cores).

5Apply the updated deployment

Deploy the changes to your cluster:

bash
kubectl apply -f deployment.yaml

Verify the rollout completed:

bash
kubectl rollout status deployment/<deployment-name> -n <namespace>

Wait for all old pods to terminate and new pods with resource requests to start.

6Verify HPA is now collecting metrics and scaling

Check that HPA can now retrieve CPU metrics:

bash
kubectl get hpa <hpa-name> -n <namespace>

You should see the 'TARGETS' column showing something like '50%/80%' instead of '<unknown>'. Describe the HPA:

bash
kubectl describe hpa <hpa-name> -n <namespace>

Look for events without 'FailedGetResourceMetric' errors. Test scaling by generating load and monitor:

bash
kubectl get hpa <hpa-name> -n <namespace> --watch

Advanced notes

HPA requires CPU requests to calculate the target number of replicas using the formula: desiredReplicas = ceil(currentCPUUsage / targetCPUUtilizationPercentage). Resource limits are NOT used in this calculation—only requests matter.

When using autoscaling/v1 with targetCPUUtilizationPercentage (deprecated), upgrading to autoscaling/v2 with the 'metrics' array provides more flexibility, allowing scaling on multiple metrics simultaneously.

For multi-container pods, each container must have its own resource requests; Kubernetes aggregates them for HPA calculations. Service mesh sidecar injection is a common source of this error—ensure your service mesh configuration includes resource requests for injected containers.

On Kubernetes 1.30+, HPA supports container-level resource metrics, enabling fine-grained scaling based on individual container CPU usage rather than pod-level aggregates.

For cost optimization, set conservative CPU requests (e.g., 100m-500m) proportional to your application's baseline usage; oversized requests reduce HPA aggressiveness and waste cluster capacity.

Frequently asked questions

What does "missing request for cpu in container" mean?
The Horizontal Pod Autoscaler (HPA) cannot compute scaling decisions because one or more containers in your pods are missing CPU resource requests in their specification. HPA calculates utilization as a percentage by dividing the current CPU usage by the requested CPU amount (utilization = current_usage / requested_resources). Without a defined CPU request, this calculation is impossible, and the HPA cannot determine whether to scale up or down.
How do I fix "missing request for cpu in container"?
The Horizontal Pod Autoscaler cannot compute scaling decisions because containers are missing CPU resource requests. HPA calculates utilization as (current_usage / requested_resources), making resource requests mandatory.
What causes "missing request for cpu in container"?
Container spec is missing the resources.requests.cpu field entirely Resources block is overwritten or duplicated in the YAML manifest, clearing the first definition Sidecar containers injected by service meshes (Istio, Linkerd) lack resource requests
Is the "missing request for cpu in container" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading