請參閱我們的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許可的所有材料