kubectl top deosn't work

8/6/2018

I'm using kubernetes 1.11.0 and running heapster. When I run

kubectl top pod

It will show error

Error from server (ServiceUnavailable): the server is currently unable to handle the request (get services http:heapster:)

while I have installed heapster already

kubectl create -f deploy/kube-config/influxdb/
kubectl create -f deploy/kube-config/rbac/heapster-rbac.yaml

Any suggest?

Update:

the command kubectl top pod works now but the endpoint doesn't work

kubectl get --raw "/apis/metrics.k8s.io/v1beta1/pods"
#Error from server (ServiceUnavailable): the server is currently unable to handle the request
-- Meysam Mahmoodi
heapster
kubectl
kubernetes

1 Answer

8/6/2018

Can you check and ensure that your kubectl binary is the latest? Something like

Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.0", GitCommit:"91e7b4fd31fcd3d5f436da26c980becec37ceefe", GitTreeState:"clean", BuildDate:"2018-06-27T22:29:25Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"darwin/amd64"} This generally happens if kubectl is older. Old kubectl versions were looking for heapster service to be present but new ones should not have this problem. Hope this helps.

In addition to above, you might want to consider moving to metrics server since heapster is on its way to being deprecated.

https://github.com/kubernetes/heapster/blob/master/docs/deprecation.md

-- Harshal Shah
Source: StackOverflow