Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

kube-capacity

> 云原生
Open source

A simple CLI that provides an overview of the resource requests, limits, and utilization in a Kubernetes cluster

2.7K stars0 likes0 views
WebsiteGitHub

About

A simple CLI that provides an overview of the resource requests, limits, and utilization in a Kubernetes cluster

kube-capacity

This is a simple CLI that provides an overview of the resource requests, limits, and utilization in a Kubernetes cluster. It attempts to combine the best parts of the output from kubectl top and kubectl describe into an easy to use CLI focused on cluster resources.

Installation

Go binaries are automatically built with each release by GoReleaser. These can be accessed on the GitHub releases page for this project.

Homebrew

This project can be installed with Homebrew:

bash
brew tap robscott/tap
brew install robscott/tap/kube-capacity

Krew

This project can be installed with Krew:

NOTE: If kube-capacity was installed using Krew, use kubectl resource-capacity instead of kube-capacity.

bash
kubectl krew install resource-capacity

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. For clusters with more than one node, the first line will also include cluster wide totals. That output will look something like this:

kube-capacity

NODE              CPU REQUESTS    CPU LIMITS    MEMORY REQUESTS    MEMORY LIMITS
*                 560m (28%)      130m (7%)     572Mi (9%)         770Mi (13%)
example-node-1    220m (22%)      10m (1%)      192Mi (6%)         360Mi (12%)
example-node-2    340m (34%)      120m (12%)    380Mi (13%)        410Mi (14%)

Including Pods

For more detailed output, kube-capacity can include pods in the output. When -p or --pods are passed to kube-capacity, it will include pod specific output that looks like this:

…

Including Utilization

To help understand how resource utilization compares to configured requests and limits, kube-capacity can include utilization metrics in the output. It's important to note that this output relies on metrics-server functioning correctly in your cluster. When -u or --util are passed to kube-capacity, it will include resource utilization information that looks like this:

kube-capacity --util

NODE              CPU REQUESTS    CPU LIMITS    CPU UTIL    MEMORY REQUESTS    MEMORY LIMITS   MEMORY UTIL
*                 560m (28%)      130m (7%)     40m (2%)    572Mi (9%)         770Mi (13%)     470Mi (8%)
example-node-1    220m (22%)      10m (1%)      10m (1%)    192Mi (6%)         360Mi (12%)     210Mi (7%)
example-node-2    340m (34%)      120m (12%)    30m (3%)    380Mi (13%)        410Mi (14%)     260Mi (9%)

Displaying Available Resources

To more clearly see the total available resources on the node it is possible to pass the --available option to kube-capacity, which will give output in the following format

kube-capacity --available

NODE              CPU REQUESTS    CPU LIMITS    MEMORY REQUESTS    MEMORY LIMITS
*                 560/2000m       130/2000m     572/5923Mi         770/5923Mi 
example-node-1    220/1000m       10/1000m      192/3200Mi         360/3200Mi 
example-node-2    340/1000m       120/1000m     380/2923Mi         410/2923Mi

Including Pods and Utilization

For more detailed output, kube-capacity can include both pods and resource utilization in the output. When --util and --pods are passed to kube-capacity, it will result in a wide output that looks like this:

…

It's worth noting that utilization numbers from pods will likely not add up to the total node utilization numbers. Unlike request and limit numbers where node and cluster level numbers represent a sum of pod values, node metrics come directly from metrics-server and will likely include other forms of resource utilization.

Sorting

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

kube-capacity --util --sort cpu.util

NODE              CPU REQUESTS    CPU LIMITS    CPU UTIL    MEMORY REQUESTS    MEMORY LIMITS   MEMORY UTIL
*                 560m (28%)      130m (7%)     40m (2%)    572Mi (9%)         770Mi (13%)     470Mi (8%)
example-node-2    340m (34%)      120m (12%)    30m (3%)    380Mi (13%)        410Mi (14%)     260Mi (9%)
example-node-1    220m (22%)      10m (1%)      10m (1%)    192Mi (6%)         360Mi (12%)     210Mi (7%)

Note Starting in v0.7.4 you can append .percentage to sort by percentage. For example, kube-capacity --util --sort cpu.util.percentage.

Displaying Pod Count

To display the pod count of each node and the whole cluster, you can pass --pod-count argument:

bash
$ kube-capacity --pod-count

NODE           CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS   POD COUNT
*              950m (2%)      200m (0%)    284Mi (0%)        284Mi (0%)      10/220
minikube       850m (5%)      100m (0%)    231Mi (1%)        231Mi (1%)      8/110
minikube-m02   100m (0%)      100m (0%)    53Mi (0%)         53Mi (0%)       2/110

Filtering By Labels

For more advanced usage, kube-capacity also supports filtering by pod, namespace, and/or node labels. The following examples show how to use these filters:

kube-capacity --pod-labels app=nginx
kube-capacity --namespace default
kube-capacity --namespace-labels team=api
kube-capacity --node-labels kubernetes.io/role=node

Filtering By Node Taints

Kube-capacity supports advanced filtering by taints. Users can filter in and filter out taints within the same expression. The following examples show how to use node taint filters:

kube-capacity --node-taints special=true:NoSchedule 
kube-capacity --node-taints special:NoSchedule 

These will return only special nodes.

kube-capacity --node-taints special=true:NoSchedule-
kube-capacity --node-taints special:NoSchedule-

These will filter out special nodes and return only unspecial nodes.

kube-capacity --node-taints special=true:NoSchedule,old-hardware:NoSchedule-

This will return special nodes that are not tainted with old-hardware:NoSchedule. In other words, display the special nodes but don't display the ones that are running on old hardware.

kube-capacity --no-taint

This will filter out all nodes with taints.

JSON and YAML Output

By default, kube-capacity will provide output in a table format. To view this data in JSON or YAML format, the output flag can be used. Here are some sample commands:

kube-capacity --pods --output json
kube-capacity --pods --containers --util --output yaml

CSV and TSV Output

If you would like the data in a comma or tab separated file to make importing the data into a spreadsheet easier the output flag has options for those as well. Here are some sample commands:

kube-capacity --pods --output csv
kube-capacity --pods --containers --util --output tsv

Note: the --available flag is ignored with these two choices as the values can be derived within a spreadsheet

Flags Supported

…

Prerequisites

Any commands requesting cluster utilization are dependent on metrics-server running on your cluster. If it's not already installed, you can install it with the official helm chart.

Similar Projects

There are already some great projects out there that have similar goals.

  • kube-resource-report: generates HTML/CSS report for resource requests and limits across multiple clusters.
  • kubetop: a CLI similar to top for Kubernetes, focused on resource utilization (not requests and limits).

Development

run make to run all tests

see Makefile for more commands

Contributors

Although this project was originally developed by robscott, there have been some great contributions from others:

  • endzyme
  • justinbarrick
  • Padarn
  • nickatsegment
  • fnickels
  • isaacnboyd

License

Apache License 2.0

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gokubernetesresource-managementutilization

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category云原生
PricingOpen source

> Related tools

K
Kubernetes
容器编排事实标准
H
Helm
Kubernetes 包管理器
S
seaweedfs
SeaweedFS is a distributed storage system for object storage (S3), file systems, and Iceberg tables,