Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Kubectx | 14,910 | 7 days ago | 26 | January 11, 2022 | 46 | apache-2.0 | Go | |||
Faster way to switch between clusters and namespaces in kubectl | ||||||||||
Kube Ps1 | 2,971 | 3 months ago | 1 | March 03, 2021 | 8 | apache-2.0 | Shell | |||
Kubernetes prompt info for bash and zsh | ||||||||||
Gbt | 474 | 2 years ago | 1 | June 18, 2021 | mit | Go | ||||
Highly configurable prompt builder for Bash, ZSH and PowerShell written in Go. | ||||||||||
Zsh Kubectl Prompt | 375 | 2 years ago | mit | Shell | ||||||
Display information about the kubectl current context and namespace in zsh prompt. | ||||||||||
Fzf Zsh Completions | 101 | 21 days ago | 1 | mit | Shell | |||||
Fuzzy completions for fzf and Zsh (git, kubectl, docker, ...) | ||||||||||
Kube Aliases | 82 | a month ago | 9 | mit | Shell | |||||
Kubernetes Aliases and Bash Functions | ||||||||||
Zsh Kubectl Completion | 30 | 2 years ago | gpl-3.0 | Makefile | ||||||
Rich zsh completion for the kubectl command. | ||||||||||
Awesome Bash Alias | 24 | 3 years ago | 6 | |||||||
A curated list of awesome Bash aliases. | ||||||||||
Dops | 22 | 4 years ago | Shell | |||||||
Docker, Docker Machine, Docker Compose, Terraform, Packer, Ansible and kubectl in Docker | ||||||||||
Plugin Kubectl | 18 | 22 days ago | mit | Shell | ||||||
Kubectl plugin for Oh My Fish (similar to oh-my-zsh kubectl) |
This script displays information about the kubectl current context and namespace in zsh prompt.
Clone this repository and source the kubectl.zsh
from your ~/.zshrc
config file, and configure your prompt.
autoload -U colors; colors
source /path/to/zsh-kubectl-prompt/kubectl.zsh
RPROMPT='%{$fg[blue]%}($ZSH_KUBECTL_PROMPT)%{$reset_color%}'
Or create different style depending on user, context, namespace. The plugin creates 4 variables:
For example, make the prompt red when the username matches admin.
autoload -U colors; colors
source /path/to/zsh-kubectl-prompt/kubectl.zsh
function right_prompt() {
local color="blue"
if [[ "$ZSH_KUBECTL_USER" =~ "admin" ]]; then
color=red
fi
echo "%{$fg[$color]%}($ZSH_KUBECTL_PROMPT)%{$reset_color%}"
}
RPROMPT='$(right_prompt)'
Also you can install with homebrew.
$ brew tap superbrothers/zsh-kubectl-prompt
$ brew install zsh-kubectl-prompt
Change the separator between context and namespace:
zstyle ':zsh-kubectl-prompt:' separator '|'
Add custom character before the prompt:
zstyle ':zsh-kubectl-prompt:' preprompt '<'
Add custom character after the prompt:
zstyle ':zsh-kubectl-prompt:' postprompt '>'
Does not display the current namespace:
zstyle ':zsh-kubectl-prompt:' namespace false
Use another binary instead of kubectl
to get the information (e.g. oc
):
zstyle ':zsh-kubectl-prompt:' binary 'oc'
If you use zgen, load this repository as follows:
source "${HOME}/.zgen/zgen.zsh"
# if the init script doesn't exist
if ! zgen saved; then
# specify plugins here
zgen load superbrothers/zsh-kubectl-prompt
# generate the init script from plugins above
zgen save
fi
autoload -U colors; colors
RPROMPT='%{$fg[blue]%}($ZSH_KUBECTL_PROMPT)%{$reset_color%}'
If you use antigen, load this repository as follows:
source /path-to-antigen/antigen.zsh
# load this plugin
antigen bundle superbrothers/zsh-kubectl-prompt
# tell antigen that you're done.
antigen apply
autoload -U colors; colors
RPROMPT='%{$fg[blue]%}($ZSH_KUBECTL_PROMPT)%{$reset_color%}'
If you use oh-my-zsh, load this repository as follows:
git clone https://github.com/superbrothers/zsh-kubectl-prompt.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-kubectl-prompt
.zshrc
by appending it to the plugin sectionplugins=( [plugins...] zsh-kubectl-prompt)
RPROMPT='%{$fg[blue]%}($ZSH_KUBECTL_PROMPT)%{$reset_color%}'
Note: Remember to source the
.zshrc
or restart your shell after step 2
This script is released under the MIT License.