Member-only story

Kubectl Tip #4

A weekly kubectl command you might find useful

Eric Fossas
2 min readJul 12, 2022
print the resource capacity of every node in your kubernetes cluster

The Command

This command will retrieve the cpu and memory capacity of all the nodes in your cluster.

It shows both “capacity” and “allocatable”. Kubelet reserves a certain amount of cpu and memory with the intention that it will be used for Kubernetes processes like kubelet and your CRI. So “allocatable” is the remaining cpu and memory that can be used for running containers.

Why would you do this?

It’s useful for seeing node capacity in your cluster, especially if you use a bunch of different node groups.

Another potential way of getting the same info is using this command:

kubectl get nodes -L beta.kubernetes.io/instance-type

That will print all your nodes with the instance type label added as a separate column. But if you’re like me, you probably have forgotten a million times how much cpu and memory an m5.8xlarge or whatever instance type has.

So sometimes it’s easier to just see the actual cpu and memory printed out.

Wrapping Up

Found the tip useful? if you did, please consider subscribing! I’ll be posting one tip every week for the rest of the year.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Responses (1)