在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jonmosco/kube-ps1开源软件地址(OpenSource Url):https://github.com/jonmosco/kube-ps1开源编程语言(OpenSource Language):Shell 100.0%开源软件介绍(OpenSource Introduction):kube-ps1: Kubernetes prompt for bash and zshA script that lets you add the current Kubernetes context and namespace
configured on Inspired by several tools used to simplify usage of InstallingMacOSHomebrew package manager:
FigFig adds apps, shortcuts, and autocomplete to your existing terminal. Install From Source
Arch LinuxAUR Package available at https://aur.archlinux.org/packages/kube-ps1/. Zshsource /path/to/kube-ps1.sh
PROMPT='$(kube_ps1)'$PROMPT Bashsource /path/to/kube-ps1.sh
PS1='[\u@\h \W $(kube_ps1)]\$ ' Zsh Plugin ManagerszinitUsingUpdate zinit light jonmosco/kube-ps1
PROMPT='$(kube_ps1)'$PROMPT RequirementsThe default prompt assumes you have the If using this with OpenShift, the
or the source can be downloaded: Set the binary to
If neither binary is available, the prompt will print the following:
Helper utilitiesThere are several great tools that make using kubectl very enjoyable:
Tmux portI have begun porting kube-ps1 to tmux as a status line plugin. If you prefer tmux, and like the functionality provided by kube-ps1, checkout the kube-tmux project Prompt StructureThe default prompt layout is:
If the current-context is not set, kube-ps1 will return the following:
Enabling/DisablingIf you want to stop showing Kubernetes status on your prompt string temporarily
run
CustomizationThe default settings can be overridden in
For terminals that do not support UTF-8, the symbol will be replaced with the
string To disable a feature, set it to an empty string:
ColorsThe default colors are set with the following environment variables:
Blue was used for the default symbol to match the Kubernetes color as closely as possible. Red was chosen as the context name to stand out, and cyan for the namespace. Set the variable to an empty string if you do not want color for each prompt section:
Names are usable for the following colors:
256 colors are available by specifying the numerical value as the variable argument. Customize display of cluster name and namespaceYou can change how the cluster name and namespace are displayed using the
For the following examples let's assume the following: cluster name: If you're using domain style cluster names, your prompt will get quite long
very quickly. Let's say you only want to display the first portion of the
cluster name ( function get_cluster_short() {
echo "$1" | cut -d . -f1
}
KUBE_PS1_CLUSTER_FUNCTION=get_cluster_short The same pattern can be followed to customize the display of the namespace.
Let's say you would prefer the namespace to be displayed in all uppercase
( function get_namespace_upper() {
echo "$1" | tr '[:lower:]' '[:upper:]'
}
export KUBE_PS1_NAMESPACE_FUNCTION=get_namespace_upper In both cases, the variable is set to the name of the function, and you must have defined the function in your shell configuration before kube_ps1 is called. The function must accept a single parameter and echo out the final value. Bug Reports and shell configurationDue to the vast ways of customizing the shell, please try the prompt with a minimal configuration before submitting a bug report. This can be done as follows for each shell before loading kube-ps1: Bash: bash --norc Zsh: zsh -f
or
zsh --no-rcs Contributors
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论