I'm using Kubernetes 1.7 and running hepaster. When I run
kubectl top nodes --heapster-namespace=kube-system
it shows me
error: metrics not available yet
I also tried this
kubectl top nodes --heapster-namespace=kube-system --heapster-service=heapster --heapster-scheme=http --heapster-port=12213
Where the heapster is running then it shows following error.
Error from server (ServiceUnavailable): the server is currently unable to handle the request (get services http:heapster:12213)
Any clue for tackling the error?
It means that heapster is not properly configured.
You need to make sure that heapster is running on
kube-system
namespace, and check if the/healthz
endpoint is ok:Then, you can check if the metrics API is available:
If it's not returning as above, take a look at container logs for errors:
$ kubectl logs -n kube-system ${HEAPSTER_POD} --all-containers
Although, keep in mind that Heapster is a deprecated project and you may have problems when running it in recent Kubernetes versions.
See Heapster Deprecation Timeline:
Since Kubernetes v1.10, the
kubectl top
relies on metrics-server by default.CHANGELOG-1.10.md:
It's better to use a
kubectl
versionv1.10
or above, as it fetches the metrics from metrics-server.However, beware of
kubectl
Version Skew Policy:Check your
kube-apiserver
version before choosing yourkubectl
version.