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.
# Install dependencies
uv sync
# Run commands
uv run k8stools <command> [args]
Alternatively, install the package to use it without the uv run prefix:
uv pip install -e .
k8stools <command> [args]
Commands
podcount
Count non-daemonset pods per node in the current Kubernetes context.
# Use current context
uv run k8stools podcount
# Specify a different context
uv run k8stools podcount --context my-context
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
Example output:
Fetching pods...
Fetching nodes...
3
Node Pod Count
!G)
node-1 12
node-2 8
node-3 15
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x004\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
Total non-DaemonSet pods: 35
Development
The project structure:
k8s-utils/
\x00\x00 k8s_utils/
\x00\x00 __init__.py
\x00\x00 main.py # CLI entry point
\x00\x00 commands/
\x00\x00 __init__.py
\x00\x00 podcount.py # podcount command implementation
\x00\x00 pyproject.toml
\x00\x00 README.md
To add a new command:
- Create a new file in
k8s_utils/commands/(e.g.,mycommand.py) - Implement your command as a function with Typer annotations
- Import and register it in
k8s_utils/main.py:
from k8s_utils.commands import mycommand
app.command(name="mycommand")(mycommand.mycommand)
Requirements
- Python 3.13+
- Access to a Kubernetes cluster with a valid kubeconfig
- uv package manager
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file k8s_helpers-1.0.2a6.tar.gz.
File metadata
- Download URL: k8s_helpers-1.0.2a6.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3d757683a184186babbb35c7c6cc50cf594ee78d420b9403aabaa15dbab9595
|
|
| MD5 |
a5e0bdd571e3754e5cb1b8b95dd474fd
|
|
| BLAKE2b-256 |
1a9065a1558eb577d2300beada0b98ef1c3b64e989308ddf6b1204d6d51ae10f
|
Provenance
The following attestation bundles were made for k8s_helpers-1.0.2a6.tar.gz:
Publisher:
ci.yml on trondhindenes/k8s-helpers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
k8s_helpers-1.0.2a6.tar.gz -
Subject digest:
d3d757683a184186babbb35c7c6cc50cf594ee78d420b9403aabaa15dbab9595 - Sigstore transparency entry: 640413187
- Sigstore integration time:
-
Permalink:
trondhindenes/k8s-helpers@45b401fb6385b12b44c925041bfa01ceb31ac713 -
Branch / Tag:
refs/heads/setup-build - Owner: https://github.com/trondhindenes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@45b401fb6385b12b44c925041bfa01ceb31ac713 -
Trigger Event:
push
-
Statement type:
File details
Details for the file k8s_helpers-1.0.2a6-py3-none-any.whl.
File metadata
- Download URL: k8s_helpers-1.0.2a6-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04c21f162dd53ab0aea33f05a4ffe748d333083748f5d9722d4fe2cc10cceceb
|
|
| MD5 |
35ad8864b84168ad17797e58dcf02ca5
|
|
| BLAKE2b-256 |
aeaa641a481e843b2e4730fc9debab12a7ba89f490727349fafd5f2b9377ea81
|
Provenance
The following attestation bundles were made for k8s_helpers-1.0.2a6-py3-none-any.whl:
Publisher:
ci.yml on trondhindenes/k8s-helpers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
k8s_helpers-1.0.2a6-py3-none-any.whl -
Subject digest:
04c21f162dd53ab0aea33f05a4ffe748d333083748f5d9722d4fe2cc10cceceb - Sigstore transparency entry: 640413196
- Sigstore integration time:
-
Permalink:
trondhindenes/k8s-helpers@45b401fb6385b12b44c925041bfa01ceb31ac713 -
Branch / Tag:
refs/heads/setup-build - Owner: https://github.com/trondhindenes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@45b401fb6385b12b44c925041bfa01ceb31ac713 -
Trigger Event:
push
-
Statement type: