Skip to main content

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 cluster
  • rich library installed (install via pip install rich)

Usage

  1. 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
  2. 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 the clean and build 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


Download files

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

Source Distribution

kubestatus-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

kubestatus-0.1.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file kubestatus-0.1.3.tar.gz.

File metadata

  • Download URL: kubestatus-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for kubestatus-0.1.3.tar.gz
Algorithm Hash digest
SHA256 90153db1a5550058e839df20ce0398558fcd91ad4e9710c2c22381bc10a0fb89
MD5 a42aaa0ca7bfa26d15f75d91d4b3edc1
BLAKE2b-256 52f5c067db0fbdaff17d6aafeeda2ad86fc28b2ac0284f32cb5a484aec3afb89

See more details on using hashes here.

File details

Details for the file kubestatus-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: kubestatus-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for kubestatus-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 952acb897b8ccf7966066bfcbe3f67bbd8fb68bf903105ae83fb66b383143ab2
MD5 b5184e3aaef82d5666388d90cdaa2e5d
BLAKE2b-256 d64f8db59c44ab0b9f7b6033e1ca389006a49b988e859220e26d66cb70705954

See more details on using hashes here.

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