10.10.2025

Optimize Kubernetes Resources with kubectl-node_resource: Cluster Capacity at a Glance

head-image

Understanding resource consumption across Kubernetes nodes requires aggregating pod requests, comparing them against node capacity, and correlating with actual metrics-server data. Native kubectl commands expose this information piecemeal, forcing operators to manually calculate free capacity or identify over-provisioned nodes. kubectl-node_resource consolidates allocation and utilization metrics into color-coded summaries, enabling instant visibility into cluster resource health for capacity planning and troubleshooting.

What is kubectl-node_resource?

kubectl-node_resource is a kubectl plugin that displays node-level resource allocation and utilization in a structured, easy-to-read format. It shows how much CPU, memory, GPU, and ephemeral storage are requested by pods (allocation) versus how much is actively being consumed (utilization) by querying metrics-server. The plugin supports filtering by node labels, sorting by usage percentage, and exporting data as JSON for integration with monitoring systems or automation scripts.

Key Features

  • Allocation View: Displays total pod resource requests per node to identify over-committed or underutilized capacity.
  • Utilization View: Shows real-time resource consumption from metrics-server for accurate performance insights.
  • Color-Coded Output: Highlights nodes approaching resource limits with visual indicators for rapid assessment.
  • Flexible Filtering: Query specific node groups by label selectors (e.g., role=worker, zone=us-east-1a).
  • JSON Export: Generate structured output for parsing by external tools or dashboards.

Installation

Install kubectl-node_resource via Krew, the kubectl plugin manager:

kubectl krew install node-resource

Verify installation:

kubectl node-resource --help

Usage

Display resource allocation across all nodes:

kubectl node-resource allocation

Show actual resource utilization using metrics-server data:

kubectl node-resource utilization

Filter results to specific node groups using label selectors:

kubectl node-resource allocation "node-role.kubernetes.io/worker"
kubectl node-resource utilization "topology.kubernetes.io/zone=us-west-2a"

Export utilization data as JSON for automation:

kubectl node-resource utilization --json > cluster-utilization.json

Sort nodes by CPU or memory usage percentage to identify resource hotspots:

kubectl node-resource utilization --sort cpu

usage

Operational Tips

  • Identify Stranded Capacity: Compare allocation vs. utilization to find nodes with high requests but low actual usage—candidates for pod redistribution.
  • Spot Overcommitment: Check allocation percentages exceeding 100% to detect nodes at risk of resource contention during traffic spikes.
  • Automate Capacity Alerts: Pipe JSON output into monitoring systems to trigger alerts when cluster-wide utilization crosses thresholds.
  • Audit GPU Usage: Use the plugin to verify GPU allocation and utilization on ML/AI workload nodes, ensuring expensive hardware isn't idle.

Conclusion

kubectl-node_resource simplifies Kubernetes capacity management by surfacing allocation and utilization metrics in a single command. Its filtering and export capabilities make it indispensable for SREs optimizing cluster efficiency and planning infrastructure scaling.

For efficient incident management and to prevent on-call burnout, consider using Akmatori. Akmatori automates incident response, reduces downtime, and simplifies troubleshooting.

Additionally, for reliable virtual machines and bare metal servers worldwide, check out Gcore.

Automate incident response and prevent on-call burnout with AI-driven agents!