Paddy
Paddy

Reputation: 659

Horizontal auto scaler doesn't report CPU usage

I am trying to test the Kubernetes HPA like in example here

kubectl run php-apache --image=gcr.io/google_containers/hpa-example --requests=cpu=200m --expose --port=80
kubectl autoscale deployment php-apache --cpu-percent=20 --min=1 --max=10
kubectl get hpa

output is

NAME         REFERENCE               TARGETS           MINPODS   MAXPODS   REPLICAS   AGE
php-apache   Deployment/php-apache   <unknown> / 20%   1         3         0          1h

Why isn't controller-manager able to get current usage?


Environment details :

failed to compute desired number of replicas based on listed metrics for Deployment/xx/php-apache: failed to get cpu utilization: unable to get metrics for resource cpu: failed to get pod resource metrics: the server cannot complete the requested operation at this time, try again later (get services http:heapster:)


Edit 1 [14-Sep] :

{ "metrics": [ { "timestamp": "2017-09-14T13:46:00Z", "value": 19008838 }, { "timestamp": "2017-09-14T13:47:00Z", "value": 19008838 }, { "timestamp": "2017-09-14T13:48:00Z", "value": 19008838 } ], "latestTimestamp": "2017-09-14T13:48:00Z" }

Grafana Screenshot for the pod. No limit was set, but that doesn't make any difference either.

Upvotes: 3

Views: 757

Answers (1)

Pawan Kumar
Pawan Kumar

Reputation: 890

Validate if heapster is fetching data and giving metric, try to run below on kube-api server, replace namespace-name and pod-name in it. it will show metric, if all well, also paste heapster log here

curl http://localhost:8080/api/v1/model/namespaces/{namespace-name}/pods/{pod-name}/metrics/

Upvotes: 0

Related Questions