Member-only story
Kubectl Tip #4
A weekly kubectl command you might find useful

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.