Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AKS Horizontal Pod Autoscaling - missing request for cpu

Tags:

azure-aks

I have been trying to set up an Kubernetes 1.13 AKS deployment to use HPA, and I keep running into a problem:

NAME                     REFERENCE                           TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
dev-hpa-poc   Deployment/dev-hpa-poc   <unknown>/50%   1         4         2          65m

Describing the HPA gives me these events:

Events:
  Type     Reason                        Age                   From                       Message
  ----     ------                        ----                  ----                       -------
  Warning  FailedComputeMetricsReplicas  5m4s (x200 over 55m)  horizontal-pod-autoscaler  failed to get cpu utilization: missing request for cpu
  Warning  FailedGetResourceMetric       3s (x220 over 55m)    horizontal-pod-autoscaler  missing request for cpu

It doesn't appear to be able to actually retrieve CPU usage. I have specified cpu and memory usage in the deployment YAML:

        resources:
          requests:
            cpu: 250m
            memory: 128Mi
          limits:
            cpu: 800m
            memory: 1024Mi

The system:metrics-server is running and healthy, too, so that's not it. I can monitor pod health and CPU usage from the Azure portal. Any ideas as to what I'm missing? Could this potentially be a permissions issue?

like image 554
Dan Bongard Avatar asked Mar 13 '26 05:03

Dan Bongard


2 Answers

for missing request for [x] make sure that all the containers in the pod have requests declared.

like image 141
nakamume Avatar answered Mar 17 '26 04:03

nakamume


In my case the reason was that other deployment haven't resource limits. You should add resources for each pod and deployment in namespace.

like image 36
Roman Avatar answered Mar 17 '26 03:03

Roman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!