请参阅我们的K9S文档网站以进行安装,使用,自定义和提示。
想与您的K9sers
讨论K9S功能,还是只是向该工具表示支持?
K9S可在Linux,MacOS和Windows平台上找到。 Linux,Windows和Mac的二进制文件在发行页中可作为Tarballs提供。
通过Homebrew for MacOS或Linux
brew install derailed/k9s/k9s
通过Macports
sudo port install k9s
通过linux的快照
snap install k9s --devmode
在Arch Linux上
pacman -S k9s
关于Opensuse Linux分布
zypper install k9s
在FreeBSD上
pkg install k9s
在Ubuntu上
wget https://github.com/derailed/k9s/releases/download/v0.32.7/k9s_linux_amd64.deb && apt install ./k9s_linux_amd64.deb && rm k9s_linux_amd64.deb
通过Windowt的Windet
winget install k9s
通过窗口的勺子
scoop install k9s
通过巧克力窗户的窗户
choco install k9s
通过GO安装
# NOTE: The dev version will be in effect!
go install github.com/derailed/k9s@latest
通过Linux和MacOS的Webi
curl -sS https://webinstall.dev/k9s | bash
通过PKGX用于Linux和MacOS
pkgx k9s
通过Windows的Webi
curl.exe -A MS https://webinstall.dev/k9s | powershell
作为Docker桌面扩展程序(用于内置Kubernetes服务器的Docker桌面)
docker extension install spurin/k9s-dd-extension:latest
K9S当前正在使用GO v1.23.x或更高版本。为了从来源构建K9S,您必须:
克隆仓库
构建并运行可执行文件
make build && ./execs/k9s
您可以通过安装KUBECONFIG
来运行K9作为Docker容器:
docker run --rm -it -v $KUBECONFIG :/root/.kube/config quay.io/derailed/k9s
对于默认路径,它将是:
docker run --rm -it -v ~ /.kube/config:/root/.kube/config quay.io/derailed/k9s
您可以从Dockerfile构建自己的docker图像,并使用以下内容:
docker build -t k9s-docker:v0.0.1 .
您可以获取最新的稳定kubectl
版本,并使用--build-arg
选项将其传递给docker build
命令。您可以使用--build-arg
选项传递任何有效的kubectl
版本(例如v1.18.0
或v1.19.1
)。
KUBECTL_VERSION= $( make kubectl-stable-version 2> /dev/null )
docker build --build-arg KUBECTL_VERSION= ${KUBECTL_VERSION} -t k9s-docker:0.1 .
运行您的容器:
docker run --rm -it -v ~ /.kube/config:/root/.kube/config k9s-docker:0.1
K9S使用256个颜色终端模式。在``nix系统上确保术语已相应设置。
export TERM=xterm-256color
为了发布资源编辑命令,请确保设置您的编辑器和kube_editor env var。
# Kubectl edit command will use this env var.
export KUBE_EDITOR=my_fav_editor
K9S更喜欢最近的Kubernetes版本,即1.28+
K9S | K8S客户端 |
---|---|
> = V0.27.0 | 1.26.1 |
V0.26.7 -V0.26.6 | 1.25.3 |
V0.26.5 -V0.26.4 | 1.25.1 |
V0.26.3 -V0.26.1 | 1.24.3 |
V0.26.0 -V0.25.19 | 1.24.2 |
V0.25.18 -V0.25.3 | 1.22.3 |
V0.25.2 -V0.25.0 | 1.22.0 |
<= V0.24 | 1.21.3 |
# List current version
k9s version
# To get info about K9s runtime (logs, configs, etc..)
k9s info
# List all available CLI options
k9s help
# To run K9s in a given namespace
k9s -n mycoolns
# Start K9s in an existing KubeConfig context
k9s --context coolCtx
# Start K9s in readonly mode - with all cluster modification commands disabled
k9s --readonly
鉴于UI K9S的性质确实会产生日志到特定位置。要查看日志并打开调试模式,请使用以下命令:
# Find out where the logs are stored
k9s info
____ __.________
| |/ _/ __ ______
| < ____ / ___/
| | / /___
|____|__ /____//____ >
/ /
Version: vX.Y.Z
Config: /Users/fernand/.config/k9s/config.yaml
Logs: /Users/fernand/.local/state/k9s/k9s.log
Dumps dir: /Users/fernand/.local/state/k9s/screen-dumps
Benchmarks dir: /Users/fernand/.local/state/k9s/benchmarks
Skins dir: /Users/fernand/.local/share/k9s/skins
Contexts dir: /Users/fernand/.local/share/k9s/clusters
Custom views file: /Users/fernand/.local/share/k9s/views.yaml
Plugins file: /Users/fernand/.local/share/k9s/plugins.yaml
Hotkeys file: /Users/fernand/.local/share/k9s/hotkeys.yaml
Alias file: /Users/fernand/.local/share/k9s/aliases.yaml
tail -f /Users/fernand/.local/data/k9s/k9s.log
k9s -l debug
您可以使用--logFile
参数覆盖默认日志文件目标:
k9s --logFile /tmp/k9s.log
less /tmp/k9s.log
或通过K9S_LOGS_DIR
环境变量:
K9S_LOGS_DIR=/var/log k9s
less /var/log/k9s.log
K9S使用别名来浏览大多数K8S资源。
行动 | 命令 | 评论 |
---|---|---|
显示主动键盘助记符和帮助 | ? | |
显示所有可用的资源别名 | ctrl-a | |
救助K9S | :quit , :q , ctrl-c | |
向上/回到上一个视图 | esc | 如果您有面包屑,这将转到前一个 |
使用单数/复数或短名查看Kubernetes资源 | : pod⏎ | 接受单数,复数,短名或别名,即豆荚或豆荚 |
在给定名称空间中查看kubernetes资源 | : pod ns-x⏎ | |
查看过滤的吊舱(新的V0.30.0!) | : pod /fred⏎ | 查看所有被弗雷德过滤的豆荚 |
查看标记的吊舱(新的V0.30.0!) | : pod app = fred,env =dev⏎ | 查看所有带有标签匹配app = fred and env = dev的豆荚 |
在给定上下文中查看豆荚(新的v0.30.0!) | : pod @ctx1⏎ | 在上下文CTX1中查看所有POD。切换您当前的K9S上下文! |
给定过滤器过滤出资源视图 | / filter⏎ | REGEX2支持IE`弗雷德 |
逆时红色过滤器 | / 是!过滤器⏎ | 保持所有不匹配的一切。 |
标签的过滤资源视图 | / -l标签 - 选择器⏎ | |
模糊找到给定过滤器的资源 | / -F滤波器⏎ | |
保释失控/命令/过滤模式 | <esc> | |
键映射以描述,查看,编辑,查看日志,... | d , v , e , l ,... | |
查看并切换到另一个Kubernetes上下文(POD视图) | : ctx⏎ | |
查看并直接切换到另一个Kubernetes上下文(最后使用的视图) | : CTX上下文名称 | |
查看并切换到另一个Kubernetes名称空间 | : ns⏎ | |
查看所有保存的资源 | : Screendump或SD⏎ | |
要删除资源(选项卡并输入以确认) | ctrl-d | |
杀死资源(无确认对话框,相当于kubectl删除 - 现在) | ctrl-k | |
发射脉冲视图 | : 脉冲或pu⏎ | |
启动X射线视图 | : x ray资源[命名空间]⏎ | 资源可以是PO,SVC,DP,RS,STS,DS,名称空间之一 |
启动Popeye视图 | : Popeye或Pop⏎ | 参见大力水平 |
K9S将其配置保持在k9s
目录内的YAML文件时,位置取决于您的操作系统。 K9S利用XDG加载其各种配置文件。有关操作系统默认位置的信息,请参阅此链接。如果您仍然感到困惑,快速k9s info
将揭示K9S在哪里加载其配置。另外,您可以将K9S_CONFIG_DIR
设置为告诉K9S目录位置以将其从中删除其配置。
Unix | macos | 视窗 |
---|---|---|
~/.config/k9s | ~/Library/Application Support/k9s | %LOCALAPPDATA%k9s |
注意:这仍然处于不断变化状态,并在释放阶段时会发生变化!
现在,您可以通过设置一个可以使用K9S_DEFAULT_PF_ADDRESS=abcd
覆盖所有群集的ENV变量来覆盖上下文portforward默认地址配置
# $XDG_CONFIG_HOME/k9s/config.yaml
k9s :
# Enable periodic refresh of resource browser windows. Default false
liveViewAutoRefresh : false
# The path to screen dump. Default: '%temp_dir%/k9s-screens-%username%' (k9s info)
screenDumpDir : /tmp/dumps
# Represents ui poll intervals. Default 2secs
refreshRate : 2
# Number of retries once the connection to the api-server is lost. Default 15.
maxConnRetry : 5
# Indicates whether modification commands like delete/kill/edit are disabled. Default is false
readOnly : false
# Toggles whether k9s should exit when CTRL-C is pressed. When set to true, you will need to exist k9s via the :quit command. Default is false.
noExitOnCtrlC : false
# UI settings
ui :
# Enable mouse support. Default false
enableMouse : false
# Set to true to hide K9s header. Default false
headless : false
# Set to true to hide the K9S logo Default false
logoless : false
# Set to true to hide K9s crumbs. Default false
crumbsless : false
noIcons : false
# Toggles reactive UI. This option provide for watching on disk artifacts changes and update the UI live Defaults to false.
reactive : false
# By default all contexts wil use the dracula skin unless explicitly overridden in the context config file.
skin : dracula # => assumes the file skins/dracula.yaml is present in the $XDG_DATA_HOME/k9s/skins directory
# Allows to set certain views default fullscreen mode. (yaml, helm history, describe, value_extender, details, logs) Default false
defaultsToFullScreen : false
# Toggles icons display as not all terminal support these chars.
noIcons : false
# Toggles whether k9s should check for the latest revision from the Github repository releases. Default is false.
skipLatestRevCheck : false
# When altering kubeconfig or using multiple kube configs, k9s will clean up clusters configurations that are no longer in use. Setting this flag to true will keep k9s from cleaning up inactive cluster configs. Defaults to false.
keepMissingClusters : false
# Logs configuration
logger :
# Defines the number of lines to return. Default 100
tail : 200
# Defines the total number of log lines to allow in the view. Default 1000
buffer : 500
# Represents how far to go back in the log timeline in seconds. Setting to -1 will tail logs. Default is -1.
sinceSeconds : 300 # => tail the last 5 mins.
# Toggles log line wrap. Default false
textWrap : false
# Toggles log line timestamp info. Default false
showTime : false
# Provide shell pod customization when nodeShell feature gate is enabled!
shellPod :
# The shell pod image to use.
image : killerAdmin
# The namespace to launch to shell pod into.
namespace : default
# The resource limit to set on the shell pod.
limits :
cpu : 100m
memory : 100Mi
# Enable TTY
tty : true
K9S与Popeye集成,Popeye是Kubernetes群集消毒剂。 Popeye本身使用称为spinach.yml
配置,但是当与K9S集成时,特定于群集的文件应为$XDG_CONFIG_HOME/share/k9s/clusters/clusterX/contextY/spinach.yml
。这使您可以每个群集具有不同的菠菜配置。
通过在给定群集上启用Nodeshell功能门,K9可以使您可以将其插入群集节点。启用后,在节点视图中,您将有一个新的s
shell
菜单选项。 K9S将使用特殊的K9S_SHELL POD在选定的节点上启动POD。此外,您可以使用带有您喜欢的外壳工具预装的自定义Docker图像来完善外壳吊舱。默认情况下,K9S使用BusyBox映像,但是您可以将其配置如下:
另外,您现在可以通过设置可以使用K9S_FEATURE_GATE_NODE_SHELL=true|false
来覆盖所有簇shell门来覆盖上下文配置。
# $XDG_CONFIG_HOME/k9s/config.yaml
k9s :
# You can also further tune the shell pod specification
shellPod :
image : cool_kid_admin:42
namespace : blee
limits :
cpu : 100m
memory : 100Mi
然后在您的群集配置文件中...
# $XDG_DATA_HOME/k9s/clusters/cluster-1/context-1
k9s :
cluster : cluster-1
readOnly : false
namespace :
active : default
lockFavorites : false
favorites :
- kube-system
- default
view :
active : po
featureGates :
nodeShell : true # => Enable this feature gate to make nodeShell available on this cluster
portForwardAddress : localhost
在K9S中,您可以定义自己的命令别名(短名称)来访问您的资源。在您的$HOME/.config/k9s
中,定义了一个称为aliases.yaml
的文件。一个K9S别名定义了一个别名:GVR。 GVR(组/版本/资源)代表一个完全合格的Kubernetes资源标识符。这是别名文件的示例:
# $XDG_DATA_HOME/k9s/aliases.yaml
aliases :
pp : v1/pods
crb : rbac.authorization.k8s.io/v1/clusterrolebindings
# As of v0.30.0 you can also refer to another command alias...
fred : pod fred app=blee # => view pods in namespace fred with labels matching app=blee
使用此别名文件,您现在可以键入:pp
或:crb
或:fred
激活其各自的命令。
输入命令模式并键入资源名称或别名,可能会很麻烦地通过经常使用资源。我们正在介绍Hotkeys,允许用户定义自己的密钥组合以激活他们喜欢的资源视图。
此外,您可以通过在$XDG_DATA_HOME/k9s/clusters/clusterX/contextY/hotkeys.yaml
中添加上下文级别配置文件来定义上下文特定的热键
为了在全球范围内浮出水热键,请按照以下步骤操作:
创建一个名为$XDG_CONFIG_HOME/k9s/hotkeys.yaml
的文件
将以下内容添加到您的hotkeys.yaml
。您可以使用资源名称/缩短名称来指定命令,即在命令模式下键入它。
# $XDG_CONFIG_HOME/k9s/hotkeys.yaml
hotKeys :
# Hitting Shift-0 navigates to your pod view
shift-0 :
shortCut : Shift-0
description : Viewing pods
command : pods
# Hitting Shift-1 navigates to your deployments
shift-1 :
shortCut : Shift-1
description : View deployments
command : dp
# Hitting Shift-2 navigates to your xray deployments
shift-2 :
shortCut : Shift-2
description : Xray Deployments
command : xray deploy
# Hitting Shift-S view the resources in the namespace of your current selection
shift-s :
shortCut : Shift-S
override : true # => will override the default shortcut related action if set to true (default to false)
description : Namespaced resources
command : " $RESOURCE_NAME $NAMESPACE "
keepHistory : true # whether you can return to the previous view
感觉不这么热吗?您的自定义热键将在帮助视图中列出吗?
。另外,您的Hotkeys文件将自动重新加载,因此您可以在定义它们时轻松使用热键。
您可以选择任何对您有意义的键盘快捷键,只要它们不是标准K9S快捷列表的一部分。
同样,也支持热键中的参考环境变量。可用的环境变量可以参考插件部分中的描述。
注意:此功能/配置可能会在未来版本中发生变化!
截至v0.25.0,您可以利用FastForwards
功能告诉K9S如何默认端口。在您要处理多个容器或容器曝光多个端口的情况下,从对话框中指定所需的端口可能会很麻烦,就像在大多数情况下一样,您已经知道您想要的哪个容器/端口元整元元元元人。对于这些用例,您现在可以通过以下注释来注释清单:
@ k9scli.io/auto-port-forwards
激活一个或多个端口 - 往返,直接绕过Port-Forward对话框。 @ k9scli.io/port-forwards
在启动port-ford对话框时预选一个或多个端口。
注释值带有形状container-name::[local-port:]container-port
注意:对于上面的任何一种情况,您都可以按名称或注释中的编号指定容器端口!
# Pod fred
apiVersion : v1
kind : Pod
metadata :
name : fred
annotations :
k9scli.io/auto-port-forwards : zorg::5556 # => will default to container zorg port 5556 and local port 5566. No port-forward dialog will be shown.
# Or...
k9scli.io/port-forwards : bozo::9090:p1 # => launches the port-forward dialog selecting default port-forward on container bozo port named p1(8081)
# mapping to local port 9090.
...
spec :
containers :
- name : zorg
ports :
- name : p1
containerPort : 5556
...
- name : bozo
ports :
- name : p1
containerPort : 8081
- name : p2
containerPort : 5555
...
注释值必须指定一个容器以转发至本地端口和容器端口。容器端口可以指定为端口号或端口名称。如果省略本地端口,则本地端口将默认为容器端口号。这里有几个例子:
bozo
上创建PF。如果HTTP指定端口号8080,则本地端口也将为8080。bozo
映射本地端口9090-> http(8080)上创建PFbozo
映射本地端口9090-> 8080 Sneakcast V0.17.0在海滩上! - 是的!声音很吮吸,但是设置真是!
您可以通过自定义视图更改给定资源的列。要浮出此功能,您将需要创建一个新的配置文件,即$XDG_CONFIG_HOME/k9s/views.yaml
。该文件利用GVR(组/版本/资源)来配置关联的表视图列。如果找不到GVR以供视图,则默认渲染将接管(即我们现在拥有的)。自定义列之后,宽宽将添加给定资源上可用的所有剩余列。要启动,您可以编辑视图配置文件并将您的资源视图实时调整!
注意:这是实验性的,随着我们的熨烫,很可能会改变!
这是一种示例视图配置,可以自定义POD和服务视图。
# $XDG_CONFIG_HOME/k9s/views.yaml
views :
v1/pods :
columns :
- AGE
- NAMESPACE
- NAME
- IP
- NODE
- STATUS
- READY
v1/services :
columns :
- AGE
- NAMESPACE
- NAME
- TYPE
- CLUSTER-IP
K9S允许您通过插件定义自己的群集命令来扩展命令行和工具。 K9S将查看$XDG_CONFIG_HOME/k9s/plugins.yaml
以找到所有可用的插件。
插件定义如下:
all
信息,以提供此快捷方式。K9S确实为您提供了其他环境变量来自定义插件参数。当前,可用的环境变量如下:
$RESOURCE_GROUP
选定的资源组$RESOURCE_VERSION
选定的资源API版本$RESOURCE_NAME
选定的资源名称$NAMESPACE
- 选定的资源名称空间$NAME
- 选定的资源名称$CONTAINER
- 当前容器(如果适用)$FILTER
- 当前过滤器(如果有)$KUBECONFIG
Kubeconfig位置。$CLUSTER
活动群集名称$CONTEXT
主动上下文名称$USER
活动用户$GROUPS
活跃组$POD
在容器视图中$COL-<RESOURCE_COLUMN_NAME>
使用给定的列名为查看资源。必须由COL-
前缀!卷曲括号可用于将环境变量嵌入另一个字符串中,或者列名称包含特殊字符。 (例如${NAME}-example
或${COL-%CPU/L}
)
这将定义用于使用ctrl-l
作为快捷方式在所选POD上查看日志的插件。
# $XDG_DATA_HOME/k9s/plugins.yaml
plugins :
# Defines a plugin to provide a `ctrl-l` shortcut to tail the logs while in pod view.
fred :
shortCut : Ctrl-L
override : false
overwriteOutput : false
confirm : false
dangerous : false
description : Pod logs
scopes :
- pods
command : kubectl
background : false
args :
- logs
- -f
- $NAME
- -n
- $NAMESPACE
- --context
- $CONTEXT
注意:这是一个实验功能!随着此功能巩固,选项和布局可能会在未来的K9释放中变化。
K9S与辉煌而超级才华横溢的Jaana Dogan相结合。 Hey
是一个基准基准HTTP端点的CLI工具,类似于AB台。目前,此初步功能支持对港口和服务进行基准测试(请阅读“这是新鲜的”油漆!)。
要设置一个端口,您将需要导航到podview,选择一个曝光给定端口的POD和一个容器。使用SHIFT-F
出现对话框,以允许您指定本地端口进行转发。确认后,您可以导航到portforward视图(Alias pf
)列出您的活动端口。选择一个端口前进并使用CTRL-B
将在该HTTP端点上运行基准测试。要查看基准运行的结果,请转到基准视图( be
)。现在,您应该能够选择一个基准测试,并通过按<ENTER>
查看运行统计信息。注意:port-forwards仅在K9S会话期间持续使用,并且将在退出时终止。
最初,基准将以以下默认值运行:
PortForward视图由新的K9S配置文件备份,即: $XDG_DATA_HOME/k9s/clusters/clusterX/contextY/benchmarks.yaml
。您连接到的每个群集都有自己的基础配置文件,其中包含群集的K8S上下文名称。该文件的更改应自动更新PortForward视图,以指示您要如何运行基准测试。
基准结果报告存储在$XDG_STATE_HOME/k9s/clusters/clusterX/contextY
中
这是示例基准。YAML配置。请记住,此文件可能会在随后的版本中更改!
# This file resides in $XDG_DATA_HOME/k9s/clusters/clusterX/contextY/benchmarks.yaml
benchmarks :
# Indicates the default concurrency and number of requests setting if a container or service rule does not match.
defaults :
# One concurrent connection
concurrency : 1
# Number of requests that will be sent to an endpoint
requests : 500
containers :
# Containers section allows you to configure your http container's endpoints and benchmarking settings.
# NOTE: the container ID syntax uses namespace/pod-name:container-name
default/nginx:nginx :
# Benchmark a container named nginx using POST HTTP verb using http://localhost:port/bozo URL and headers.
concurrency : 1
requests : 10000
http :
path : /bozo
method : POST
body :
{"fred":"blee"}
header :
Accept :
- text/html
Content-Type :
- application/json
services :
# Similarly you can Benchmark an HTTP service exposed either via NodePort, LoadBalancer types.
# Service ID is ns/svc-name
default/nginx :
# Set the concurrency level
concurrency : 5
# Number of requests to be sent
requests : 500
http :
method : GET
# This setting will depend on whether service is NodePort or LoadBalancer. NodePort may require vendor port tunneling setting.
# Set this to a node if NodePort or LB if applicable. IP or dns name.
host : A.B.C.D
path : /bumblebeetuna
auth :
user : jean-baptiste-emmanuel
password : Zorg!
在启用RBAC的群集上,您需要赋予您的用户/组功能,以便他们可以使用K9S探索其Kubernetes群集。 K9S需要在群集和名称空间级别上最少读取特权才能显示资源和指标。
以下这些规则只是建议。您需要根据环境政策来自定义它们。如果您需要编辑/删除资源,则需要额外的fu。
笔记!随着K9S的发展,群集/名称空间访问可能会在将来发生变化。笔记!我们希望K9即使在萎缩的簇/名称空间中也能继续运行。如果不是这样,请提出问题!
---
# K9s Reader ClusterRole
kind : ClusterRole
apiVersion : rbac.authorization.k8s.io/v1
metadata :
name : k9s
rules :
# Grants RO access to cluster resources node and namespace
- apiGroups : [""]
resources : ["nodes", "namespaces"]
verbs : ["get", "list", "watch"]
# Grants RO access to RBAC resources
- apiGroups : ["rbac.authorization.k8s.io"]
resources : ["clusterroles", "roles", "clusterrolebindings", "rolebindings"]
verbs : ["get", "list", "watch"]
# Grants RO access to CRD resources
- apiGroups : ["apiextensions.k8s.io"]
resources : ["customresourcedefinitions"]
verbs : ["get", "list", "watch"]
# Grants RO access to metric server (if present)
- apiGroups : ["metrics.k8s.io"]
resources : ["nodes", "pods"]
verbs : ["get", "list", "watch"]
---
# Sample K9s user ClusterRoleBinding
apiVersion : rbac.authorization.k8s.io/v1
kind : ClusterRoleBinding
metadata :
name : k9s
subjects :
- kind : User
name : fernand
apiGroup : rbac.authorization.k8s.io
roleRef :
kind : ClusterRole
name : k9s
apiGroup : rbac.authorization.k8s.io
如果您的用户受到某些命名空间的约束,则K9S将需要遵循角色以启用对名称空间资源的访问。
---
# K9s Reader Role (default namespace)
kind : Role
apiVersion : rbac.authorization.k8s.io/v1
metadata :
name : k9s
namespace : default
rules :
# Grants RO access to most namespaced resources
- apiGroups : ["", "apps", "autoscaling", "batch", "extensions"]
resources : ["*"]
verbs : ["get", "list", "watch"]
# Grants RO access to metric server
- apiGroups : ["metrics.k8s.io"]
resources : ["pods", "nodes"]
verbs :
- get
- list
- watch
---
# Sample K9s user RoleBinding
apiVersion : rbac.authorization.k8s.io/v1
kind : RoleBinding
metadata :
name : k9s
namespace : default
subjects :
- kind : User
name : fernand
apiGroup : rbac.authorization.k8s.io
roleRef :
kind : Role
name : k9s
apiGroup : rbac.authorization.k8s.io
示例:德古拉皮肤;)
您可以根据自己的外观和风格来定型K9S。皮肤是YAML文件,它使用户能够更改K9S的演示层。有关示例,请参见此存储蛋白skins
目录。默认情况下,您可以通过指定UI. -skin属性来皮肤K9。您也可以根据您要连接的上下文更改K9S皮肤。在这种情况下,您可以在群集config aka skin: dracula
(只是没有扩展名的皮肤文件的名称!),然后将此repo skins/dracula.yaml
复制到$XDG_CONFIG_HOME/k9s/skins/
directory。
在群集跨越多个上下文的情况下,您可以在上下文配置中添加皮肤上下文配置。这是{context_name,skin}元组的集合(请参见下面的示例!)
颜色可以通过名称定义或使用十六进制表示。最近,我们添加了一种名为default
的颜色,以指示透明的背景颜色,以保留您的终端背景颜色设置。
注意:目前,这是一项实验功能,如果此功能具有相应的螺纹,将添加/修改更多!注意:请参阅K9S皮肤以获取可用颜色的列表。
对于特定的上下文,并提供了您的皮肤目录中的文件in_the_navy.yaml
。
# $XDG_DATA_HOME/k9s/clusters/clusterX/contextY/config.yaml
k9s :
cluster : clusterX
skin : in_the_navy
readOnly : false
namespace :
active : default
lockFavorites : false
favorites :
- kube-system
- default
view :
active : po
featureGates :
nodeShell : false
portForwardAddress : localhost
您还可以为Root K9S配置文件中所有上下文中的所有上下文指定默认皮肤:
# $XDG_CONFIG_HOME/k9s/config.yaml
k9s :
liveViewAutoRefresh : false
screenDumpDir : /tmp/dumps
refreshRate : 2
maxConnRetry : 5
readOnly : false
noExitOnCtrlC : false
ui :
enableMouse : false
headless : false
logoless : false
crumbsless : false
noIcons : false
# Toggles reactive UI. This option provide for watching on disk artifacts changes and update the UI live Defaults to false.
reactive : false
# By default all contexts wil use the dracula skin unless explicitly overridden in the context config file.
skin : dracula # => assumes the file skins/dracula.yaml is present in the $XDG_DATA_HOME/k9s/skins directory
defaultsToFullScreen : false
skipLatestRevCheck : false
disablePodCounting : false
shellPod :
image : busybox
namespace : default
limits :
cpu : 100m
memory : 100Mi
imageScans :
enable : false
exclusions :
namespaces : []
labels : {}
logger :
tail : 100
buffer : 5000
sinceSeconds : -1
textWrap : false
showTime : false
thresholds :
cpu :
critical : 90
warn : 70
memory :
critical : 90
warn : 70
# $XDG_DATA_HOME/k9s/skins/in_the_navy.yaml
# Skin InTheNavy!
k9s :
# General K9s styles
body :
fgColor : dodgerblue
bgColor : ' #ffffff '
logoColor : ' #0000ff '
# ClusterInfoView styles.
info :
fgColor : lightskyblue
sectionColor : steelblue
# Help panel styles
help :
fgColor : white
bgColor : black
keyColor : cyan
numKeyColor : blue
sectionColor : gray
frame :
# Borders styles.
border :
fgColor : dodgerblue
focusColor : aliceblue
# MenuView attributes and styles.
menu :
fgColor : darkblue
keyColor : cornflowerblue
# Used for favorite namespaces
numKeyColor : cadetblue
# CrumbView attributes for history navigation.
crumbs :
fgColor : white
bgColor : steelblue
activeColor : skyblue
# Resource status and update styles
status :
newColor : ' #00ff00 '
modifyColor : powderblue
addColor : lightskyblue
errorColor : indianred
highlightcolor : royalblue
killColor : slategray
completedColor : gray
# Border title styles.
title :
fgColor : aqua
bgColor : white
highlightColor : skyblue
counterColor : slateblue
filterColor : slategray
views :
# TableView attributes.
table :
fgColor : blue
bgColor : darkblue
cursorColor : aqua
# Header row styles.
header :
fgColor : white
bgColor : darkblue
sorterColor : orange
# YAML info styles.
yaml :
keyColor : steelblue
colonColor : blue
valueColor : royalblue
# Logs styles.
logs :
fgColor : lightskyblue
bgColor : black
indicator :
fgColor : dodgerblue
bgColor : black
toggleOnColor : limegreen
toggleOffColor : gray
没有这些好人的贡献,这个项目将是一个愚蠢的人!
这仍在进行中!如果某些内容破裂或您想要的功能,请提交问题,如果这样倾向于提交PR!
如果...
K9S坐落在许多开源项目和图书馆之上。我们对所有在夜晚和周末工作的OSS贡献者的真诚感谢,以使该项目成为现实!
费尔南德·加里亚纳(Fernand Galiana)
Aleksei Romanenko
我们总是喜欢从我们工作中受益的人们的来信!
©2023 Imhotep Software LLC。根据Apache v2.0许可的所有材料