Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find available resources in a Kubernetes Cluster level?

Tags:

kubernetes

Do we have a simple command through which we can find the available resources at cluster level?

Available CPU and Memory requests.

like image 650
karthikeayan Avatar asked Jan 23 '26 13:01

karthikeayan


1 Answers

There are couple of ways to achieve this. You didn't mention what environment are you using, however you probably already have metric server in your cluster.

1. Top command

kubectl top pods or kubectl top nodes. This way you will be able to check current usage of pods/nodes. You can also narrow it to namespace.

2. Describe node

If you will execute kubectl describe node, in output you will be able to see Capacity of that node and how much allocated resources left. Similar with Pods.

...
Capacity:
 attachable-volumes-gce-pd:  127
 cpu:                        1
 ephemeral-storage:          98868448Ki
 hugepages-2Mi:              0
 memory:                     3786684Ki
 pods:                       110
Allocatable:
 attachable-volumes-gce-pd:  127
 cpu:                        940m
 ephemeral-storage:          47093746742
 hugepages-2Mi:              0
 memory:                     2701244Ki
 pods:                       110
 ...

3. Prometheus

If you need more detailed information with statistics, I would recommend you to use Prometheus. It will allow you to create statistics of nodes/pods, generate alerts and many more. It also might provide metrics not only CPU and Memory but also custom.metrics which can create statistics of all Kubernetes objects.

Many useful information can be found here.

like image 106
PjoterS Avatar answered Jan 26 '26 18:01

PjoterS