Easy to list Kubernetes resource requests and limits with kube-capacity

Tram Ho

When we work with Kubernetes, to check the resource requests and limits we will use kubectl describe, and to check the utilization of the resources we will use kubectl top. Today we will talk about the kube-capacity CLI that combines the two CLI above and provides an overview of the resource requests, limits, and utilization.

For example, the illustration.

Installation

On macOS, this project can be installed with Homebrew:

On Linux, we go to the releases page and select the appropriate Linux Package, for example with me:

Move to one of the directories located in $PATH:

Check if we have installed it successfully:

Usage

By default, kube-capacity will output a list of nodes with the total CPU and Memory resource requests and limits for all the pods running on them.

Default

For clusters with more than one node, the first line will also include cluster wide totals.

Including Pods

For more detailed output about the requests and limits of each Pod, add the flags --pods or -p to kube-capacity.

Filtering By Namespace

To list by namespace, we use the flags --namespace or -n

Including Utilization

In case we need to check the utilization of the resources, we use the flags --util or -u.

Note: It’s important to note that this output relies on metrics-server functioning correctly in your cluster.

Sorting

To highlight the nodes, pods, and containers with the highest metrics, you can sort by a variety of columns:

Conclusion

This is a helpful tool when we need quickly check resource requests and limits.

Share the news now

Source : Viblo