Top Related Projects
Faster way to switch between clusters and namespaces in kubectl
Kubernetes shell: An integrated shell for working with the Kubernetes
⎈❏ Terminal and Web console for Kubernetes
Bash script to tail Kubernetes logs from multiple pods at the same time
🐶 Kubernetes CLI To Manage Your Clusters In Style!
Quick Overview
kube-prompt is an interactive Kubernetes client tool that provides an enhanced command-line interface for managing Kubernetes clusters. It offers features like auto-completion, syntax highlighting, and command suggestions, making it easier for users to interact with Kubernetes resources and execute kubectl commands.
Pros
- Intuitive auto-completion for Kubernetes resources and commands
- Syntax highlighting for improved readability
- Command history and suggestions for faster workflow
- Cross-platform support (Linux, macOS, Windows)
Cons
- Limited to command-line interface, may not suit users preferring graphical tools
- Requires separate installation alongside kubectl
- May have a learning curve for users accustomed to traditional kubectl usage
- Potential for lag in updates to support new Kubernetes features
Getting Started
To install kube-prompt, you can use one of the following methods:
- Using Go:
go install github.com/c-bata/kube-prompt@latest
- Using Homebrew (macOS):
brew install kube-prompt
- Download pre-built binaries from the GitHub releases page.
After installation, simply run kube-prompt
in your terminal to start the interactive Kubernetes client.
Competitor Comparisons
Faster way to switch between clusters and namespaces in kubectl
Pros of kubectx
- Lightweight and focused on context/namespace switching
- Provides shell completion for easier use
- Supports both bash and zsh shells
Cons of kubectx
- Limited functionality compared to kube-prompt
- Doesn't provide an interactive prompt environment
- Lacks advanced features like auto-suggestion and syntax highlighting
Code Comparison
kubectx:
kubectx my-context
kubens my-namespace
kube-prompt:
$ kube-prompt
>>> kubectl config use-context my-context
>>> kubectl config set-context --current --namespace=my-namespace
Key Differences
kube-prompt offers an interactive shell-like environment for Kubernetes operations, while kubectx focuses specifically on context and namespace switching. kube-prompt provides more comprehensive functionality, including auto-suggestions and syntax highlighting, making it suitable for users who prefer a more interactive and feature-rich experience. On the other hand, kubectx is lightweight and efficient for quick context and namespace changes, with better shell integration.
kube-prompt may be preferred by users who want a dedicated Kubernetes command environment, while kubectx is ideal for those who primarily need quick context/namespace switching capabilities within their existing shell setup.
Both tools serve different purposes and can be valuable additions to a Kubernetes workflow, depending on the user's specific needs and preferences.
Kubernetes shell: An integrated shell for working with the Kubernetes
Pros of kube-shell
- More feature-rich with file completion, command validation, and context switching
- Actively maintained with recent updates and contributions
- Supports fish-style auto-suggestions for faster command input
Cons of kube-shell
- Heavier and potentially slower due to more features
- May have a steeper learning curve for new users
- Requires additional dependencies (prompt-toolkit, pygments)
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 getClusterName(config *restclient.Config) string {
if config.CurrentContext == "" {
return ""
}
return config.Contexts[config.CurrentContext].Cluster
}
Both projects aim to enhance the Kubernetes CLI experience, but kube-shell offers more features at the cost of complexity. kube-prompt is simpler and lighter, focusing on basic prompt functionality. The code snippets show different approaches to retrieving cluster information, with kube-shell using a subprocess call and kube-prompt directly accessing the configuration.
⎈❏ Terminal and Web console for Kubernetes
Pros of kubebox
- Offers a terminal UI with real-time updates and monitoring capabilities
- Provides a more comprehensive view of Kubernetes resources in a single interface
- Supports multiple clusters and namespaces simultaneously
Cons of kubebox
- Written in JavaScript, which may have performance implications compared to Go
- Less focused on command-line completion and more on overall cluster visualization
- May have a steeper learning curve due to its more complex interface
Code comparison
kube-prompt:
func completeResource(d prompt.Document) []prompt.Suggest {
// Resource completion logic
}
kubebox:
function watchPods(namespace) {
// Pod watching and updating logic
}
Key differences
kube-prompt is primarily a command-line tool focused on providing intelligent auto-completion for kubectl commands. It's written in Go and aims to enhance the kubectl experience with suggestions and completions.
kubebox, on the other hand, is a terminal-based UI for Kubernetes that offers a more comprehensive view of cluster resources. It provides real-time updates and monitoring capabilities, making it suitable for ongoing cluster management and visualization.
While kube-prompt excels in command-line interactions, kubebox offers a more holistic approach to cluster management with its terminal UI. The choice between the two depends on whether you prefer enhanced command-line functionality or a more visual, dashboard-like experience for managing Kubernetes clusters.
Bash script to tail Kubernetes logs from multiple pods at the same time
Pros of kubetail
- Lightweight and focused on a single task (tailing logs)
- Easy to use with a simple command-line interface
- Supports multiple pods and containers simultaneously
Cons of kubetail
- Limited functionality compared to kube-prompt
- No interactive mode or auto-completion features
- Requires separate installation and doesn't provide a full kubectl wrapper
Code Comparison
kubetail:
kubetail my-pod-name -n my-namespace
kube-prompt:
kube-prompt
kube> logs my-pod-name -n my-namespace
Summary
kubetail is a specialized tool for tailing Kubernetes logs, offering a straightforward approach to monitoring multiple pods. It's lightweight and easy to use but lacks the comprehensive features of kube-prompt.
kube-prompt, on the other hand, provides an interactive shell with auto-completion and a wider range of kubectl functionalities. It offers a more integrated experience but may have a steeper learning curve for users who only need log tailing capabilities.
The choice between these tools depends on the user's specific needs and workflow preferences. kubetail is ideal for quick log monitoring tasks, while kube-prompt is better suited for users who require a more comprehensive Kubernetes CLI environment.
🐶 Kubernetes CLI To Manage Your Clusters In Style!
Pros of k9s
- Rich, interactive terminal UI with real-time updates
- Supports multiple views and resource types
- Extensive keyboard shortcuts for efficient navigation
Cons of k9s
- Steeper learning curve due to more complex interface
- Requires more system resources than kube-prompt
Code Comparison
kube-prompt:
func completeResource(d prompt.Document) []prompt.Suggest {
// Simple completion logic
}
k9s:
func (v *View) Draw(screen tcell.Screen) {
// Complex drawing logic for interactive UI
// Multiple lines of code for layout and styling
}
Additional Notes
kube-prompt is a simpler, lightweight tool focused on command-line completion for kubectl commands. It's easier to learn and use for basic operations.
k9s offers a more comprehensive solution for managing Kubernetes clusters with its feature-rich terminal UI. It provides deeper insights and more advanced functionality but may be overwhelming for beginners.
Both tools aim to improve Kubernetes management efficiency, but k9s is better suited for power users who frequently interact with clusters, while kube-prompt is ideal for those seeking basic command assistance.
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-prompt
An interactive kubernetes client featuring auto-complete using go-prompt.
kube-prompt accepts the same commands as the kubectl, except you don't need to provide the kubectl
prefix.
So it doesn't require the additional cost to use this cli.
And you can integrate other commands via pipe (|
).
>>> get pod | grep web
web-1144924021-2spbr 1/1 Running 4 25d
web-1144924021-5r1fg 1/1 Running 4 25d
web-1144924021-pqmfq 1/1 Running 4 25d
Installation
Downloading standalone binary
Binaries are available from github release.
macOS (darwin) - amd64
wget https://github.com/c-bata/kube-prompt/releases/download/v1.0.11/kube-prompt_v1.0.11_darwin_amd64.zip
unzip kube-prompt_v1.0.11_darwin_amd64.zip
chmod +x kube-prompt
sudo mv ./kube-prompt /usr/local/bin/kube-prompt
Linux - amd64
wget https://github.com/c-bata/kube-prompt/releases/download/v1.0.11/kube-prompt_v1.0.11_linux_amd64.zip
unzip kube-prompt_v1.0.11_linux_amd64.zip
chmod +x kube-prompt
sudo mv ./kube-prompt /usr/local/bin/kube-prompt
Linux - i386
wget https://github.com/c-bata/kube-prompt/releases/download/v1.0.11/kube-prompt_v1.0.11_linux_386.zip
unzip kube-prompt_v1.0.11_linux_386.zip
chmod +x kube-prompt
sudo mv ./kube-prompt /usr/local/bin/kube-prompt
Linux - arm64
wget https://github.com/c-bata/kube-prompt/releases/download/v1.0.11/kube-prompt_v1.0.11_linux_arm64.zip
unzip kube-prompt_v1.0.11_linux_arm64.zip
chmod +x kube-prompt
sudo mv ./kube-prompt /usr/local/bin/kube-prompt
Using Homebrew (macOS)
$ brew install c-bata/kube-prompt/kube-prompt
Arch Linux
An unofficial AUR package kube-prompt
is available. Install instructions can be found on the Arch
wiki.
Building from source
$ GO111MODULE=on go build .
To create a multi-platform binary, use the cross command via make:
$ make cross
Similar projects
- kube-shell: An integrated shell for working with the Kubernetes written in Python using python-prompt-toolkit.
Goal
Hopefully support following commands enough to operate kubernetes.
-
get
Display one or many resources -
describe
Show details of a specific resource or group of resources -
create
Create a resource by filename or stdin -
replace
Replace a resource by filename or stdin. -
patch
Update field(s) of a resource using strategic merge patch. -
delete
Delete resources by filenames, stdin, resources and names, or by resources and label selector. -
edit
Edit a resource on the server -
apply
Apply a configuration to a resource by filename or stdin -
namespace
SUPERSEDED: Set and view the current Kubernetes namespace -
logs
Print the logs for a container in a pod. -
rolling-update
Perform a rolling update of the given ReplicationController. -
scale
Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job. -
cordon
Mark node as unschedulable -
drain
Drain node in preparation for maintenance -
uncordon
Mark node as schedulable -
attach
Attach to a running container. -
exec
Execute a command in a container. -
port-forward
Forward one or more local ports to a pod. -
proxy
Run a proxy to the Kubernetes API server -
run
Run a particular image on the cluster. -
expose
Take a replication controller, service, or pod and expose it as a new Kubernetes Service -
autoscale
Auto-scale a Deployment, ReplicaSet, or ReplicationController -
rollout
rollout manages a deployment -
label
Update the labels on a resource -
annotate
Update the annotations on a resource -
config
config modifies kubeconfig files -
cluster-info
Display cluster info -
api-versions
Print the supported API versions on the server, in the form of "group/version". -
version
Print the client and server version information. -
explain
Documentation of resources. -
convert
Convert config files between different API versions -
top
Display Resource (CPU/Memory/Storage) usage
Author
Masashi Shibata
- Twitter: @c_bata_
- Github: @c-bata
- Facebook: Masashi Shibata
LICENSE
This software is licensed under the MIT License (See LICENSE).
Top Related Projects
Faster way to switch between clusters and namespaces in kubectl
Kubernetes shell: An integrated shell for working with the Kubernetes
⎈❏ Terminal and Web console for Kubernetes
Bash script to tail Kubernetes logs from multiple pods at the same time
🐶 Kubernetes CLI To Manage Your Clusters In Style!
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