Skip to main content

Collection of Kubernetes command-line utilities

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k8s_helpers-1.0.12.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k8s_helpers-1.0.12-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file k8s_helpers-1.0.12.tar.gz.

File metadata

  • Download URL: k8s_helpers-1.0.12.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for k8s_helpers-1.0.12.tar.gz
Algorithm Hash digest
SHA256 dc271ac0be2f1494b157b9db02b99dad36aafa862ee85a16278feb7c9d511a8d
MD5 e1297019ba9aae06ef24a07496465061
BLAKE2b-256 d6676b73e966dda95a13ed981b23056afe7e3a0e96f0130ee1dd2607e3a78997

See more details on using hashes here.

Provenance

The following attestation bundles were made for k8s_helpers-1.0.12.tar.gz:

Publisher: ci.yml on trondhindenes/k8s-helpers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k8s_helpers-1.0.12-py3-none-any.whl.

File metadata

  • Download URL: k8s_helpers-1.0.12-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for k8s_helpers-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 27886c03252a7efafcf3669056b7724ad6c26bc64a8d3f841a46491eec2d0da5
MD5 ae09698ba88b6dafa378447dd053d58a
BLAKE2b-256 ecde0a4f649e5e82721b8d4c44551ed5c81c25a7f702d8295d5ac8b7cc7ef79a

See more details on using hashes here.

Provenance

The following attestation bundles were made for k8s_helpers-1.0.12-py3-none-any.whl:

Publisher: ci.yml on trondhindenes/k8s-helpers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page