How to get the available resources (memory, cpu) in a K8s cluster?

3/25/2019

I would like to know what resources are available in the entire K8s cluster that I am using.

To be clear, I am not talking about the Resource Quotas, because those only define resources per namespace. I would like to know what the capabilities of the entire cluster are (memory, cpu,...). Please note that the sum of all resource quotas is not equal to the capabilities of the cluster. The sum can be greater (creates race condition for resources between namespaces) or smaller (cluster not used to its fullest potential) than the resources of the cluster.

Can I use kubectl to answer this query?

-- User12547645
kubectl
kubernetes
resources

1 Answer

3/25/2019

You can use kubectl top command to check the memory and CPU consumption of all the nodes or pods.

kubectl top nodes

For more information you can do,

kubectl top -h

For kubectl top command to work, you need to install metrics-server in kubernetes cluster to fetch the CPU and memory metrics.

-- Prafull Ladha
Source: StackOverflow