kubeclient icon indicating copy to clipboard operation
kubeclient copied to clipboard

Kubectl top pod not available

Open akshaylakhe opened this issue 5 years ago • 4 comments

it would be helpful to add top command in kubeclient to check pod level resource usage

akshaylakhe avatar Feb 26 '20 06:02 akshaylakhe

Can you run kubectl with --loglevel=11 to see what requests it does to gather the info?

cben avatar Feb 26 '20 07:02 cben

Try this:

kubectl = Kubeclient::Client.new (
  'https://kubernetes.default.svc/apis/metrics.k8s.io',
  'v1beta1',
  auth_options: auth_options,
  ssl_options: ssl_options
)
kubectl.get_nodes

zanloy avatar Mar 11 '20 18:03 zanloy

One gotcha that just got me stuck for a while was for whatever reason, the get_entity method for get_node isn't generated. To get a single node by name, you have to do this:

kubectl.get_entity('nodes', '10.0.0.1')

zanloy avatar Mar 11 '20 19:03 zanloy

Whoa, now that is interesting!

cben avatar Mar 12 '20 05:03 cben