Question

kubectl top node|pod

It looks like heapster is not enabled on the cluster? Is this a planned feature?

kubectl top node
Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)

I’ve used the same on other cloud providers (AKS, IKS) and it seems to be enabled…

Subscribe
Share

I would also like to know this.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can easily install metrics server to your cluster via marketplace:

https://marketplace.digitalocean.com/apps/kubernetes-metrics-server

  • Install metrics server chart

  • Update the command metrics server deployment and add the following two options to the pod command :

      - --kubelet-insecure-tls
      - --kubelet-preferred-address-types=InternalIP
    

Command will be look like this :

   command:
    - /metrics-server
    - --kubelet-insecure-tls
    - --kubelet-preferred-address-types=InternalIP

Wait two or three minutes, then the “top” command should work.

You have to deploy heapster in your cluster to collect metrics ;) by default its not activated on digitalocean k8s-cluster.

There is a helm chart for heapster: https://github.com/helm/charts/tree/master/stable/heapster

The following will help with understanding what is happening on the nodes:

$ cat bin/node-resources.sh 
#!/bin/bash
set -euo pipefail

echo -e "Iterating...\n"

nodes=$(kubectl get node --no-headers -o custom-columns=NAME:.metadata.name)

for node in $nodes; do
  echo "Node: $node"
  kubectl describe node "$node" | sed '1,/Non-terminated Pods/d'
  echo
done

From https://github.com/kubernetes/kubernetes/issues/17512