No project description provided
Project description
Klube CLI Tool
Klube is a command-line interface (CLI) tool designed to simplify interactions with Kubernetes clusters. It provides a set of convenient commands that wrap around kubectl, making it easier to perform common operations like viewing logs, executing commands in pods, and copying files to and from pods.
Table of Contents
Installation
You can easily install Klube using pip:
pip install klube
During the installation process, Klube will automatically create an initial configuration file at ~/.klube/config.json. This file will contain default settings, including the default Kubernetes namespace.
After installation, you'll see a message confirming the creation of the configuration file and instructions on how to modify it.
Usage
After installation, you can use the klube command from anywhere in your terminal. The basic syntax is:
klube <command> [arguments]
If Klube doesn't recognize the command, it will pass it through to kubectl along with any arguments.
Key Features
Flexible Pod Identification
One of Klube's standout features is its flexible pod identification system. Unlike traditional kubectl commands that require exact pod names, Klube allows you to use as many or as few identifiers as you need to uniquely identify a pod. This can significantly speed up your workflow, especially in environments with many similarly named pods.
For example, if you have a pod named backend-service-5f7d9c7b5-2nlzx, you could use any of the following to identify it:
klube logs backend
klube logs backend service
klube logs backend-service-5f7d9c7b5-2nlzx
Klube will find the first pod that matches all provided identifiers. This feature works across all Klube commands, making it a powerful tool for quick Kubernetes operations.
Flexible Namespace Selection
Klube provides multiple ways to specify the Kubernetes namespace you want to work with, offering flexibility and ease of use:
- Command-line argument:
klube --namespace mynamespace <command> - Environment variable:
export LUBE_NAMESPACE=mynamespace - User configuration file: Set using
klube config NAMESPACE mynamespace - Default: If not specified, Klube uses the "default" namespace
The order of precedence is: Command-line argument > Environment variable > User configuration file > Default
This allows you to easily switch between namespaces for different projects or environments without modifying your scripts or commands.
Commands
Klube currently supports the following commands:
logs: View logs from a podexec: Execute a command in a podcp: Copy files to or from a podconfig: View or set configuration options
Examples
[Examples remain the same as in the previous version]
Configuration
Klube uses a user-specific configuration file located at ~/.klube/config.json. This file is created automatically during the installation process, and it can be viewed or modified using the klube config command.
The initial configuration file includes:
NAMESPACE: The default Kubernetes namespace to use (default: "default")
You can add other configuration options as needed. Remember that the namespace specified in the config file can be overridden by an environment variable or command-line argument.
To view your current configuration:
klube config
To modify a configuration option:
klube config KEY VALUE
For example, to change the default namespace:
klube config NAMESPACE my-namespace
Project Structure
klube/
├── setup.py
├── post_install.py
├── README.md
├── main.py
└── commands/
├── base.py
├── logs/
│ └── handler.py
├── exec/
│ └── handler.py
└── cp/
└── handler.py
setup.py: Package configuration for installationpost_install.py: Script to set up initial configuration during installationmain.py: Entry point for the CLI tool, handles configuration and command routingcommands/: Directory containing command handlersbase.py: Base class for command handlerslogs/,exec/,cp/: Specific command implementations
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed 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 Distributions
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 klube-0.1.0-py3-none-any.whl.
File metadata
- Download URL: klube-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a01ba42af2241cf1aec6a8de1a7881b1d2a33ef70b836b5d0af81df8e879a47
|
|
| MD5 |
d70b773f41809d9befcd60849ae78376
|
|
| BLAKE2b-256 |
3c049a5b24217b4dddd93350e653b06343c88db2c6984b89ebc86b7726305bc2
|