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.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 952acb897b8ccf7966066bfcbe3f67bbd8fb68bf903105ae83fb66b383143ab2 |
|
MD5 | b5184e3aaef82d5666388d90cdaa2e5d |
|
BLAKE2b-256 | d64f8db59c44ab0b9f7b6033e1ca389006a49b988e859220e26d66cb70705954 |