Skip to main content

k8s-utils

A collection of Kubernetes command-line utilities built with Python and Typer.

Installation

This project uses uv for package management. Make sure you have uv and uvx installed.

Just testing it out:

# Install dependencies
uvx k8s-helpers --help

Installation

uv tool install k8s-helpers

This installs the k8s-helpers command and the shorthand k8sh

Commands

podcount

Count non-daemonset pods per node in the current Kubernetes context.

# Use current context
k8sh podcount --help

# Specify a different context
k8sh podcount --context my-context

# Show nodegroup and zone labels, and sort by nodegroup
k8sh podcount \
--node-labels "eks.amazonaws.com/nodegroup" \
--node-labels "topology.kubernetes.io/zone" \
--sort "eks.amazonaws.com/nodegroup" \
--show-taints

This command:

  • Retrieves all pods and nodes in the cluster
  • Excludes pods managed by DaemonSets
  • Displays a table showing pod count per node
  • Shows total non-DaemonSet pod count

delpods

Delete pods matching certain statuses across namespaces.

# Delete pods with specific statuses across all namespaces
k8sh delpods --all-namespaces --status ImagePullBackOff --status CrashLoopBackOff

# Preview what would be deleted (dry run)
k8sh delpods -A --status CrashLoopBackOff --dry-run

# Delete in specific namespace without confirmation
k8sh delpods -n default --status Error --yes

# Use specific context
k8sh delpods -c my-cluster -A --status ImagePullBackOff

Available arguments:

  • --all-namespaces, -A: Search pods in all namespaces
  • --namespace, -n: Specify a namespace (default: current context namespace)
  • --status: Pod status to match (can be specified multiple times)
  • --dry-run: Show what would be deleted without deleting
  • --yes, -y: Skip confirmation prompt
  • --context, -c: Kubernetes context to use

resources

Analyze CPU and memory consumption per node (excluding DaemonSet pods).

# Show all nodes
k8sh resources

# Analyze single node (faster for large clusters)
k8sh resources --node my-node-name

# Include pod breakdown
k8sh resources -p

# Sort by memory requests
k8sh resources --sort mem-req

Shows requests, limits, allocatable capacity, and actual usage (if metrics-server is available).

node

Analyze resource waste for pods on a specific node.

# Analyze waste on a node
k8sh node my-node-name

# Sort by CPU waste
k8sh node my-node-name --sort cpu-waste

Shows actual usage vs requests, with color-coded waste percentages (green=efficient, red=wasteful).

Metadata

Release files for k8s-helpers 1.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for k8s-helpers 1.0.14
File Size Uploaded Provenance
k8s_helpers-1.0.14.tar.gz 24.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for k8s-helpers 1.0.14
File Interpreter ABI Platform
k8s_helpers-1.0.14-py3-none-any.whl Python 3 none any Details

Total release size: 39.7 kB

Release files / k8s_helpers-1.0.14.tar.gz

Download URL k8s_helpers-1.0.14.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
92264ba945e5a7490406765824cd8d09c1d1dcbc23d211166644a860f553e9ac
BLAKE2b-256 checksum
How to use checksums
f3d10405a54b09fe7b8f4d8fa7243240d1d7a05fc9443c42646f7eed9ba0c74d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 2, 2026.

Transparency log

Release files / k8s_helpers-1.0.14-py3-none-any.whl

Download URL k8s_helpers-1.0.14-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d542a38008f731f6cd3c3c9ef072636017c4f80be0122f39f2f8dc57b864a78
BLAKE2b-256 checksum
How to use checksums
94e2a40d4e2e32876aafe1275271e8e1905f206beb9662de48bcdced134e3b2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 2, 2026.

Transparency log

Security for k8s-helpers 1.0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for k8s_helpers-1.0.14.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page