Top Related Projects
An interactive kubernetes client featuring auto-complete.
Faster way to switch between clusters and namespaces in kubectl
⎈❏ Terminal and Web console for Kubernetes
🐶 Kubernetes CLI To Manage Your Clusters In Style!
Bash script to tail Kubernetes logs from multiple pods at the same time
Quick Overview
Kube-shell is an integrated shell for working with Kubernetes clusters. It provides a user-friendly interface with auto-completion, syntax highlighting, and inline documentation for kubectl commands, making it easier for developers and operators to interact with Kubernetes.
Pros
- Enhanced productivity with auto-completion and syntax highlighting
- Inline documentation for kubectl commands, reducing the need to consult external resources
- User-friendly interface with a fish-style auto-suggestion mechanism
- Supports multiple Kubernetes contexts and namespaces
Cons
- May require additional setup compared to using kubectl directly
- Limited to command-line interface, not suitable for users who prefer graphical tools
- Potential learning curve for users accustomed to standard kubectl usage
- Depends on external libraries, which may introduce compatibility issues
Getting Started
To install and use kube-shell:
# Install kube-shell using pip
pip install kube-shell
# Launch kube-shell
kube-shell
# Once inside kube-shell, you can use kubectl commands with enhanced features
> kubectl get pods
> kubectl describe deployment my-app
> kubectl apply -f my-config.yaml
After launching kube-shell, you'll have access to auto-completion, syntax highlighting, and inline documentation for kubectl commands. Use Tab for auto-completion and Ctrl+C to exit the shell.
Competitor Comparisons
An interactive kubernetes client featuring auto-complete.
Pros of kube-prompt
- Written in Go, which may offer better performance and easier installation on some systems
- Supports custom resource completion
- Provides a simpler, more focused interface for Kubernetes CLI interactions
Cons of kube-prompt
- Less feature-rich compared to kube-shell (e.g., lacks syntax highlighting)
- Not as actively maintained (last commit was in 2019)
- May have a steeper learning curve for users familiar with more shell-like interfaces
Code Comparison
kube-shell:
def get_cluster_name():
cmd = "kubectl config view --minify --output 'jsonpath={..context.cluster}'"
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
output = process.communicate()[0].decode('utf-8').strip()
return output
kube-prompt:
func (c *Completer) getClusterName() string {
out, err := exec.Command("kubectl", "config", "view", "--minify", "--output", "jsonpath={..context.cluster}").Output()
if err != nil {
return ""
}
return strings.TrimSpace(string(out))
}
Both projects aim to enhance the Kubernetes CLI experience, but they take different approaches. kube-shell provides a more comprehensive shell-like environment with additional features, while kube-prompt focuses on providing a simpler, prompt-based interface for Kubernetes commands. The choice between them depends on user preferences and specific use cases.
Faster way to switch between clusters and namespaces in kubectl
Pros of kubectx
- Lightweight and focused on specific tasks (switching contexts and namespaces)
- Easy to install and use with minimal dependencies
- Provides shell completion for faster workflow
Cons of kubectx
- Limited functionality compared to kube-shell's comprehensive features
- Lacks interactive mode and real-time auto-suggestions
- No built-in kubectl command execution capabilities
Code Comparison
kubectx:
# Switch to a different context
kubectx my-cluster
# Switch to a different namespace
kubens my-namespace
kube-shell:
# Interactive shell with auto-suggestions
>>> kubectl get pods
>>> kubectl describe deployment my-app
kube-shell offers a more interactive and feature-rich environment, while kubectx focuses on quick context and namespace switching. kube-shell provides real-time suggestions and command execution within its shell, whereas kubectx is designed for rapid context management from the command line.
Both tools serve different purposes and can be used complementarily in a Kubernetes workflow. kube-shell is better suited for extended kubectl interactions, while kubectx excels at fast context and namespace switching.
⎈❏ Terminal and Web console for Kubernetes
Pros of Kubebox
- Cross-platform support (Linux, macOS, Windows)
- Standalone binary with no dependencies
- Real-time monitoring and live log streaming
Cons of Kubebox
- Less interactive features compared to Kube-shell
- Steeper learning curve for new users
- Limited customization options
Code Comparison
Kubebox (JavaScript):
const blessed = require('blessed');
const contrib = require('blessed-contrib');
const screen = blessed.screen();
Kube-shell (Python):
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
Key Differences
- Kubebox is written in JavaScript, while Kube-shell is written in Python
- Kubebox provides a terminal-based dashboard, whereas Kube-shell offers an interactive shell
- Kubebox focuses on real-time monitoring, while Kube-shell emphasizes command auto-completion and suggestions
Use Cases
Kubebox is better suited for:
- Users who need cross-platform support
- Administrators who require real-time monitoring
Kube-shell is more appropriate for:
- Users who prefer an interactive shell experience
- Developers who want extensive auto-completion features
Both tools aim to enhance Kubernetes cluster management, but they cater to different user preferences and workflow styles.
🐶 Kubernetes CLI To Manage Your Clusters In Style!
Pros of k9s
- More feature-rich and actively maintained
- Offers a full-screen terminal UI with real-time updates
- Supports multiple clusters and contexts
Cons of k9s
- Steeper learning curve due to more complex interface
- Requires more system resources compared to kube-shell
Code Comparison
k9s uses a custom terminal UI framework:
func (v *View) Draw(screen tcell.Screen) {
v.Lock()
defer v.Unlock()
v.draw(screen)
}
kube-shell uses the Python prompt-toolkit:
def get_prompt_tokens(self):
return [(Token.Prompt, '>> ')]
Key Differences
- Language: k9s is written in Go, while kube-shell is in Python
- UI: k9s provides a full-screen interface, kube-shell offers a command-line prompt
- Functionality: k9s offers more advanced features like log viewing and resource editing
- Installation: k9s is a single binary, kube-shell requires Python and dependencies
Use Cases
- k9s: Suitable for power users and administrators who need comprehensive cluster management
- kube-shell: Ideal for users who prefer a simpler, command-line interface for basic Kubernetes operations
Both tools aim to enhance Kubernetes CLI experience, but k9s offers a more comprehensive solution at the cost of increased complexity, while kube-shell provides a simpler, more focused approach.
Bash script to tail Kubernetes logs from multiple pods at the same time
Pros of kubetail
- Lightweight and focused tool for tailing Kubernetes logs
- Easy to use with simple command-line interface
- Supports multi-pod log tailing and color-coding
Cons of kubetail
- Limited functionality compared to kube-shell's comprehensive features
- Lacks interactive shell capabilities and auto-completion
- No built-in Kubernetes resource management tools
Code Comparison
kubetail:
kubetail my-pod-prefix -n my-namespace
kube-shell:
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
# Interactive shell with auto-suggestions and history
kubetail is a specialized tool for tailing Kubernetes logs, while kube-shell provides a more comprehensive interactive shell environment for Kubernetes cluster management. kubetail excels in simplicity and ease of use for log monitoring, but lacks the broader feature set of kube-shell, which includes auto-completion, interactive prompts, and integrated Kubernetes resource management capabilities.
kube-shell offers a more robust solution for users who require extensive Kubernetes interaction, while kubetail is ideal for users focused primarily on log monitoring and analysis. The choice between the two depends on the specific needs of the user and the complexity of their Kubernetes workflows.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
kube-shell
|Build Status| |PyPI version| |PyPI pyversions| |License| |Gitter chat|
Kube-shell: An integrated shell for working with the Kubernetes CLI
Under the hood kube-shell still calls kubectl. Kube-shell aims to provide ease-of-use of kubectl and increasing productivity.
kube-shell features
Auto Completion of Commands and Options with in-line documentation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: http://i.imgur.com/dfelkKr.gif :alt:
Fish-Style Auto Suggestions ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: http://i.imgur.com/7VciOuR.png :alt:
Command History ^^^^^^^^^^^^^^^
You can use up-arrow and down-arrow to walk through the history of commands executed. Also up-arrow partial string matching is possible. For e.g. enter 'kubectl get' and use up-arrow and down-arrow to browse through all kubectl get commands. You could also use CTRL+r to search from the history of commands.
.. figure:: http://i.imgur.com/xsIM3QV.png :alt:
Fuzzy Searching ^^^^^^^^^^^^^^^
.. figure:: http://i.imgur.com/tW9oAUO.png :alt:
Server Side Auto Completion ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: http://i.imgur.com/RAfHXjx.gif :alt:
Context information ^^^^^^^^^^^^^^^^^^^
Details of current context from kubeconfig is always readily displayed on the bottom toolbar. By pressing F4 button you can switch between the clusters and using F5 can switch between namespaces.
.. figure:: http://i.imgur.com/MJLgcj3.png :alt:
vi editing mode ^^^^^^^^^^^^^^^
Press ESC you have all key bindings (w: next word, b: prev word) to move across the words.
Installation
The kube-shell requires python and
pip <https://pypi.python.org/pypi/pip>
__ to install. You can
install the kube-shell using pip
:
.. code:: bash
$ pip install kube-shell
Usage
After installing kube-shell through pip, just run kube-shell to bring up shell.
At the kube-shell command prompt you can run exit or press F10 to exit the shell. You can clear the screen by running clear command.
By default drop-down suggestion list also displays in-line documentation, you can turn on/off inline documnetation by pressing F4 button.
You can run any shell command by prefixing command with "!". For e.g. !ls would list from the current directory.
Under the hood
Other than generation of suggestions all heavy lifting is done by
Python's prompt toolkit <https://github.com/jonathanslenders/python-prompt-toolkit>
,
Pygments <http://pygments.org>
libraries.
A GO program <misc/python_eats_cobra.go>
__ is used to generate
kubectl's commands, subcommands, arguments, global options and local
options in json <kubeshell/data/cli.json>
__ format. Kube-shell uses
generated json file to suggest commands, subcommands, options and args.
For server side completion kube-shell uses
client-python <https://github.com/kubernetes-incubator/client-python>
__
libray to fetch the resources.
Status
Kube-shell should be useful now. But given that its aim is to increase
productivity and easy of use, it can be improved in a number of ways. If
you have suggestions for improvements or new features, or run into a bug
please open an issue
here <https://github.com/cloudnativelabs/kube-shell/issues>
__ or chat
in the Gitter <https://gitter.im/kube-shell/Lobby>
__.
Acknowledgement
Kube-shell is inspired by AWS Shell <https://github.com/awslabs/aws-shell>
,
SAWS <https://github.com/donnemartin/saws>
and uses awesome Python
prompt toolkit <https://github.com/jonathanslenders/python-prompt-toolkit>
__
.. |Build Status| image:: https://travis-ci.org/cloudnativelabs/kube-shell.svg?branch=master :target: https://travis-ci.org/cloudnativelabs/kube-shell .. |PyPI version| image:: https://badge.fury.io/py/kube-shell.svg :target: https://badge.fury.io/py/kube-shell .. |PyPI pyversions| image:: https://img.shields.io/pypi/pyversions/ansicolortags.svg :target: https://pypi.python.org/pypi/kube-shell/ .. |License| image:: http://img.shields.io/:license-apache-blue.svg :target: http://www.apache.org/licenses/LICENSE-2.0.html .. |Gitter chat| image:: http://badges.gitter.im/kube-shell/Lobby.svg :target: https://gitter.im/kube-shell/Lobby
Top Related Projects
An interactive kubernetes client featuring auto-complete.
Faster way to switch between clusters and namespaces in kubectl
⎈❏ Terminal and Web console for Kubernetes
🐶 Kubernetes CLI To Manage Your Clusters In Style!
Bash script to tail Kubernetes logs from multiple pods at the same time
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot