Do we have a simple command through which we can find the available resources at cluster level?
Available CPU and Memory requests.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With