kusage

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2025 License: MIT

README

kusage

Rank pods/containers by resource usage-to-limit ratio

Features:

  • Memory-bounded streaming (processes k8s data through bounded channels)
  • Adaptive pagination with API client/call optimization (chunked data retrieval)
  • Circuit breaker with resource pools (prevent cascading failures)

Usage

# Analyze pod-level memory usage with custom namespace filtering
kusage pods -A --resource memory --nx '^(observability|kube-system)$' --top 10 --sort pct

# Container analysis with custom sort and limit
kusage containers -n production --resource=memory --sort limit --top 5

Requirements

  • Kubernetes Permissions:
    • pods (get, list) in target namespaces
    • pods/metrics (get, list) via metrics.k8s.io API group
  • Cluster Components:

Installation

You can install kusage CLI using one of the following ways:

See the release section for kusage checksums and SBOMs.

Homebrew

On Mac or Linux, you can install kusage with Homebrew:

brew tap mchmarny/kusage
brew install kusage

New release will be automatically picked up when you run brew upgrade

Go

If you have Go 1.17 or newer, you can install latest vimp using:

go install github.com/mchmarny/kusage/cmd/kusage@latest
Binary

You can also download the latest release version of kusage for your operating system/architecture from here. Put the binary somewhere in your $PATH, and make sure it has that executable bit.

The official kusage releases include SBOMs

Disclaimer

This is my personal project and it does not represent my employer. While I do my best to ensure that everything works, I take no responsibility for issues caused by this code.

Directories

Path Synopsis
cmd
kusage command
pkg
analyzer
Package analyzer provides data analysis and sorting functionality for resource usage metrics.
Package analyzer provides data analysis and sorting functionality for resource usage metrics.
cli
Package cli provides command-line interface functionality for kusage.
Package cli provides command-line interface functionality for kusage.
collector
Package collector implements the core data collection logic for Kubernetes resource metrics.
Package collector implements the core data collection logic for Kubernetes resource metrics.
config
Package config provides configuration management for kusage.
Package config provides configuration management for kusage.
filters
Package filters provides efficient filtering for Kubernetes resources
Package filters provides efficient filtering for Kubernetes resources
k8s
Package k8s provides Kubernetes client management and configuration.
Package k8s provides Kubernetes client management and configuration.
metrics
Package metrics provides data structures and utilities for Kubernetes resource metrics.
Package metrics provides data structures and utilities for Kubernetes resource metrics.
observability
Package observability provides comprehensive monitoring and metrics for large-scale operations
Package observability provides comprehensive monitoring and metrics for large-scale operations
output
Package output provides formatted output functionality for resource usage analysis results.
Package output provides formatted output functionality for resource usage analysis results.
resilience
Package resilience provides fault tolerance and resource management for large-scale operations
Package resilience provides fault tolerance and resource management for large-scale operations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL