kube-capacity
Show cluster resource requests, limits, and utilization
TLDR
List nodes including the total CPU and Memory resource requests and limits
Include pods
Include utilization
SYNOPSIS
kube-capacity [options]
PARAMETERS
--context string
Kubernetes context to use. Uses current context in kubeconfig if unspecified.
--kubeconfig string
Path to the kubeconfig file to use for CLI requests.
--no-color
Disable color output.
--output string
Output format. One of: text, json. (default "text")
--pod-selector string
Selector (label query) to filter on pods. Supports '=', '==', and '!='. Example: --pod-selector key1=value1,key2=value2.
--resource string
Resource to display. One of: cpu, memory, gpu (default "cpu,memory")
--show-pods
Show individual pods. (default false)
--sort string
Sort by column. One of: node, namespace, pod, resource, requested, limit, utilization (default "node")
--namespace string
Only show information about resources in the specified namespace.
--help
Show help menu.
DESCRIPTION
kube-capacity is a command-line tool that provides a real-time view of resource requests, limits, and utilization across a Kubernetes cluster.
It aggregates data from nodes, pods, and containers to present a concise and human-readable summary of CPU, memory, and GPU resources. This allows administrators to quickly assess cluster health, identify potential resource bottlenecks, and optimize resource allocation.
Unlike `kubectl top`, `kube-capacity` focuses on the *requested* and *limited* resources rather than the *actual* usage. This makes it an invaluable tool for capacity planning and identifying pods that are under- or over-requesting resources.
The tool can output data in different formats (e.g., plain text, JSON), making it suitable for integration with monitoring systems and dashboards. It helps visualize cluster capacity and resource distribution across namespaces, nodes, and workloads.
CAVEATS
The output represents resource *requests* and *limits*, not actual usage.
GPU support depends on proper GPU resource configuration in your Kubernetes cluster.
Accuracy depends on the resource requests and limits defined for your pods and containers.
Requires appropriate Kubernetes RBAC permissions to access cluster resources.
<B>EXAMPLES</B>
Display CPU and Memory capacity for all nodes:
kube-capacity
Display CPU capacity sorted by requested resources: kube-capacity --resource cpu --sort requested
Display CPU capacity for pods in 'default' namespace:kube-capacity --resource cpu --namespace default
<B>TROUBLESHOOTING</B>
Permissions errors: Ensure your Kubernetes user has the necessary RBAC permissions to access node and pod resources.
No data displayed: Verify that pods have resource requests and limits defined.
Incorrect data: Double-check resource definitions in your pod specifications.
HISTORY
kube-capacity was developed to provide a more comprehensive and easily understandable view of Kubernetes cluster capacity compared to standard `kubectl` commands. It evolved as a tool for administrators and developers to optimize resource allocation and plan for future growth. It is available as a community developed open source tool and provides valuable insights into Kubernetes cluster resource management