0

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
  • 433
  • 5
  • 19

1 Answers1

3

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
  • 587
  • 4
  • 14
  • My version is `Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.0", GitCommit:"91e7b4fd31fcd3d5f436da26c980becec37ceefe", GitTreeState:"clean", BuildDate:"2018-06-27T20:17:28Z", GoVersion:"go1.10.2", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:43:26Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}` As you see that is latest version. I have so confused about this problem:/ – Meysam Mahmoodi Aug 06 '18 at 12:42
  • Hey @MeysamMahmoodi have you also added metrics server to your cluster? – Harshal Shah Aug 06 '18 at 13:01
  • Yes I have installed it before heapster installation – Meysam Mahmoodi Aug 06 '18 at 13:23
  • 1
    I have pinged you on kubernetes slack also, we can probably do following to dig further: run kubectl output in debug mode to see which API call is failing. check logs of metrics server and heapster to see where we run into problems. I think the call flow should be kubectl --> metrics server --> heapster but I'm not very sure. – Harshal Shah Aug 06 '18 at 15:05
  • Finally I solved the problem. I had two nodes that had installed different version of Kubernetes on them! My master node was v1.11.0 but nodes were v1.10.0. I upgraded nodes to new version and the problem is solved. Thank you for help – Meysam Mahmoodi Aug 07 '18 at 08:11
  • Now I have new problem with `Heapster`. When I run `kubectl get --raw "/apis/metrics.k8s.io/v1beta1/pods"` It returns empty result: `{"kind":"PodMetricsList","apiVersion":"metrics.k8s.io/v1beta1","metadata":{"selfLink":"/apis/metrics.k8s.io/v1beta1/pods"},"items":[]}` while I have 4 pods. Do I ask new question about this problem? – Meysam Mahmoodi Aug 07 '18 at 08:15
  • For this issue make new question please. – Nick Rak Aug 07 '18 at 12:27
  • @HarshalShah metrics server must be installed before run command kubectl top? – pain Oct 26 '18 at 08:33