Kubernetes HPA shows CPU unknown: Check per-container requests and the metrics API

If a Kubernetes HorizontalPodAutoscaler shows CPU as <unknown>, check its events before editing thresholds. A resource-utilization target needs usable CPU metrics and relevant CPU requests. Adding a more aggressive threshold does not supply a missing denominator.

1. Read what the controller could not evaluate

kubectl describe hpa -n serving inference
kubectl top pod -n serving --containers
kubectl get deployment -n serving inference -o yaml

These are read-only checks for an authorized namespace. Check the HPA target reference and events, such as FailedGetResourceMetric. Then compare Pods selected by that target. If resource metrics are missing across several workloads, look at the cluster's metrics pipeline and access before changing the workload. If CPU samples are available, check which metric type the HPA requests: a percentage of requested CPU has a different denominator from an absolute value.

2. Check the running Pods, including containers you did not author

For a Pod-level resource utilization metric, missing relevant CPU requests can leave the Pod's utilization undefined even when the monitoring chart shows CPU usage. Look at the live Pod spec as well as the Deployment template. A newly injected sidecar can change the set of containers the autoscaler considers. Some clusters default requests during admission, so the live specification provides the authoritative comparison. Compare like units: a request of 250m is one quarter of a CPU core.

Review a realistic request for each relevant container and account for scheduling capacity. If your platform uses a container-specific autoscaling metric for a supported Kubernetes version, check whether the named container exists across the selected live Pods. Match the metric to the workload that should drive scaling instead of applying different requests to force a convenient percentage.

3. Watch the affected metric after a controlled rollout

In a hypothetical staging deployment, a single target container uses roughly 200 millicores and requests 400 millicores. That represents about 50% of its CPU request. A Pod-level autoscaler should be evaluated separately from this simple calculation if there are sidecars or multiple Pods. After applying the intended resource spec, wait for old replicas to complete their rollout and fresh metrics to arrive. Confirm the target is numeric, the expected condition clears, and a safe workload test changes the desired replicas as intended.

If the target remains unknown, check the resource metrics API, the HPA target reference, and whether fresh Ready Pods have appeared. An autoscaler at its maximum replica count with a valid numeric target is a different condition. Investigate outstanding capacity, stabilization settings, and application bottlenecks with that evidence. Nothing here claims a live traffic test was run.

Sources

댓글

이 블로그의 인기 게시물

소니 A6000 Wi-Fi 전송 (컴퓨터로 보내기)

SVN 서버 설치 및 웹 접속 설정-Ubuntu 14.04

VirtualBox(VM) 화면 크기 조절