No project description provided
Project description
Kubernetes Namespace Status Viewer
This Python script provides a continually updating display of the status of various Kubernetes objects within a specified namespace. The script uses kubectl
to fetch data and displays it in a formatted table using the rich
library.
Features
- Display status of Pods, Services, Deployments, and Container Image Counts.
- Auto-refreshes every 5 seconds for real-time status updates.
- Option to specify a Kubernetes namespace or auto-select the namespace of the first pod.
Requirements
- Python 3
kubectl
configured for access to a Kubernetes clusterrich
library installed (install viapip install rich
)
Usage
-
Running the Script:
- To specify a namespace:
python kube_status.py -n <your_namespace>
- To use the default namespace (the namespace of the first pod from the current context):
python kube_status.py
- To specify a namespace:
-
Stopping the Script: Press
Ctrl+C
to exit the continuous update loop.
Distribution
The package can be built and distributed using the provided Makefile
. setuptools
, twine
and wheel
should already be installed locally. The following commands are available:
make clean
: Clean up previous build artifacts.make build
: Build the package into a distributable format.make upload
: Upload the package to PyPI.make dist
: Run theclean
andbuild
steps sequentially.make all
: Clean, build, and upload the package to PyPI.
Before running make upload
, ensure that you have registered an account on PyPI and configured your .pypirc
file with your credentials.
Functions
get_kubectl_output
: Executes a kubectl command and returns its output.get_default_namespace
: Determines the default namespace based on the first pod's namespace.create_pods_table
: Creates a table displaying the status of Pods.create_services_table
: Creates a table displaying the status of Services.create_deployments_table
: Creates a table displaying the status of Deployments.create_image_count_table
: Creates a table displaying the count of unique container images.main
: The main loop of the script, updating and displaying status tables.
License
This script is released under the MIT License.
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
Hashes for kubestatus-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2beff18e8afebf2d015b33d8de885ded680ccaf1e6588fea0c118567d0c7b944 |
|
MD5 | 4c53d96393868c5b644734b4c2768b98 |
|
BLAKE2b-256 | c45100ade5c67570d3a972c81afe8fe9418bec6db5c0e8652abdd7aad1452f13 |