Cloud Native 7 min read

Master Kubernetes Resource Insights with kube-capacity CLI

This guide explains how to install and use the kube-capacity command‑line tool to quickly view resource requests, limits, and utilization for pods and nodes in a Kubernetes cluster, including advanced options for filtering, JSON/YAML output, and integration with metrics‑server.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Kubernetes Resource Insights with kube-capacity CLI

Using kube-capacity CLI to View Kubernetes Resource Requests, Limits, and Utilization

kube-capacity

is a simple yet powerful CLI that provides an overview of resource requests, limits, and utilization in a Kubernetes cluster, combining the best parts of kubectl top and kubectl describe.

Traditional commands like kubectl get pod -n kube-system -o=custom-columns=... are long and cumbersome; kube-capacity solves this by offering a concise view of pod resource configurations.

Installation

The binary is built by GoReleaser for each release and can be downloaded from the project's GitHub releases page.

https://github.com/goreleaser/goreleaser
https://github.com/robscott/kube-capacity/releases

Homebrew

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

Krew

kubectl krew install resource-capacity

Basic Usage

By default, kube-capacity outputs a node list showing total CPU and memory requests and the limits of all pods running on each node. For clusters with multiple nodes, the first line also includes cluster‑wide totals.

Include Pods

Use -p or --pods to include pod‑specific output.

Include Utilization

Pass -u or --util to add resource utilization metrics (requires a running metrics-server in the cluster).

Pods and Utilization

Combine --util and --pods for a wide output that includes both pod details and utilization.

Show Pod Count

Display the number of pods per node and cluster-wide with the --pod-count flag.

Label Filtering

Advanced usage allows filtering by pod, namespace, and/or node labels.

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

JSON and YAML Output

By default, output is tabular. Use --output json or --output yaml for structured data.

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

Supported Flags

Prerequisites

Any command that requests cluster utilization depends on a running metrics-server. If it is not installed, you can deploy it using the official Helm chart.

https://github.com/helm/charts/tree/master/stable/metrics-server
https://github.com/kubernetes-incubator/metrics-server
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

CLICloud NativeKubernetesResource Monitoringmetrics-serverkube-capacity
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.