<p>Do your instance groups have labels identifying the groups they belong to? If so, you can filter to them using the <code>-l</code>/<code>--selector</code> option, like so:</p>
<pre class="lang-bash prettyprint-override"><code>kubectl top nodes --selector instance-group=group-1
</code></pre>
<p>This assumes that the label name is <code>instance-group</code> and the label value for the group you want to query is <code>group-1</code>.</p>

CC BY-SA 4.0
2021-03-18T12:44:56.793Z
2021-03-18T12:44:56.793Z
alastairs
<p>I have a couple separate instance groups, and <code>kubectl top nodes</code> will display the CPU and Memory usage of all nodes. I'd like to be able to just ask for the information for a specific instance group if possible.</p>

<kubernetes><kubectl>
How to get CPU and Memory usage of nodes in a specific Kubernetes instance group?
James
# How to get CPU and Memory usage of nodes in a specific Kubernetes instance group?

(Asked by: username_0 on 2020-11-20)

I have a couple separate instance groups, and `kubectl top nodes` will display the CPU and Memory usage of all nodes. I'd like to be able to just ask for the information for a specific instance group if possible.

**Tags:** kubernetes, kubectl


---

## 1 answers

### Answer by username_1 on 2021-03-18. Score: 2

Do your instance groups have labels identifying the groups they belong to? If so, you can filter to them using the -l/--selector option, like so:
kubectl top nodes --selector instance-group=group-1

This assumes that the label name is instance-group and the label value for the group you want to query is group-1.


---

