설치, 사용, 사용자 정의 및 팁은 K9S 문서 사이트를 참조하십시오.
동료 K9sers
와 K9S 기능에 대해 논의하고 싶 거나이 도구에 대한 지원을 간단히 보여주고 싶습니까?
K9S는 Linux, MacOS 및 Windows 플랫폼에서 제공됩니다. Linux, Windows 및 Mac 용 Binaries는 릴리스 페이지에서 Tarballs로 제공됩니다.
MacOS 또는 Linux 용 홈브류를 통해
brew install derailed/k9s/k9s
Macports를 통해
sudo port install k9s
스냅을 통해 Linux
snap install k9s --devmode
아치 리눅스에서
pacman -S k9s
OpenSuse Linux 배포
zypper install k9s
freebsd에서
pkg install k9s
우분투에서
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
Windows 용 Winget을 통해
winget install k9s
창문을 통해
scoop install k9s
Windows 용 Chocolate를 통해
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
Linux 및 MacOS 용 PKGX를 통해
pkgx k9s
Windows 용 Webi를 통해
curl.exe -A MS https://webinstall.dev/k9s | powershell
Docker Desktop Extension (Kubernetes 서버에 내장 된 Docker Desktop의 경우)
docker extension install spurin/k9s-dd-extension:latest
K9S는 현재 GO v1.23.x 이상을 사용하고 있습니다. 소스에서 K9를 구축하려면 다음을 수행해야합니다.
레포를 복제하십시오
실행 파일을 빌드하고 실행하십시오
make build && ./execs/k9s
KUBECONFIG
장착하여 K9S를 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 vars가 설정되어 있는지 확인하십시오.
# 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 K9의 특성을 고려할 때 특정 위치에 로그를 생성합니다. 로그를보고 디버그 모드를 켜려면 다음 명령을 사용하십시오.
# 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 | |
K9에서 구제하기 위해 | :quit , :q , ctrl-c | |
이전보기로 올라가기 위해 | esc | 부스러기가 있다면, 이것은 이전의 부스러기로갑니다. |
단수/복수형 또는 짧은 이름을 사용하여 Kubernetes 리소스를 봅니다 | : 포드 | 단수, 복수, 짧은 이름 또는 별명 IE 포드 또는 포드를 허용합니다. |
주어진 네임 스페이스에서 Kubernetes 리소스를 봅니다 | : POD NS-X- | |
필터링 된 포드보기 (새로운 V0.30.0!) | : 포드 /프레드 | Fred가 필터링 한 모든 포드를보십시오 |
라벨이 붙은 포드보기 (새로운 V0.30.0!) | : pod app = fred, env = dev⏎ | 레이블이 일치하는 모든 포드를 app = fred 및 env = dev |
주어진 맥락에서 포드를 봅니다 (새로운 V0.30.0!) | : pod @ctx1 c | 컨텍스트 CTX1에서 모든 포드를 봅니다. 현재 K9S 컨텍스트를 전환합니다! |
필터가 주어진 자원보기를 필터링하십시오 | / 필터 ⏎ | REGEX2는 IE`Fred를 지원했습니다 |
역 정규 필터 | / ! 필터 ⏎ | 일치 하지 않는 모든 것을 유지하십시오. |
레이블 별 자원보기 필터 | / -L 레이블 -선택기 label | |
퍼지 필터가 주어진 리소스를 찾으십시오 | / -f 필터 ⏎ | |
시야/명령/필터 모드를 구제합니다 | <esc> | |
설명,보기, 편집,보기 로그, ... | d , v , e , l , ... | |
다른 Kubernetes 컨텍스트를보고 전환하려면 (POD View) | : ctx⏎ | |
다른 Kubernetes 컨텍스트를 직접보고 전환하려면 (마지막으로 사용 된보기) | : ctx context-name ⏎ | |
다른 Kubernetes 네임 스페이스를보고 전환합니다 | : ns⏎ | |
저장된 모든 자원을 보려면 | : Screendump 또는 SDump | |
리소스를 삭제하려면 (탭 및 입력하여 확인) | ctrl-d | |
리소스를 죽이려면 (확인 대화 상자 없음, Kubectl delete -now와 동일) | ctrl-k | |
펄스보기를 시작합니다 | : 펄스 또는 푸 | |
Xray View를 시작하십시오 | : Xray Resource [네임 스페이스] ⏎ | 리소스는 PO, SVC, DP, RS, STS, DS, DS, 네임 스페이스 중 하나 일 수 있습니다. |
Popeye View를 시작하십시오 | : popeye 또는 pop or | Popeye를 참조하십시오 |
K9S는 k9s
디렉토리 내부의 YAML 파일로 구성을 유지하며 위치는 운영 체제에 따라 다릅니다. K9S는 XDG를 활용하여 다양한 구성 파일을로드합니다. OS의 기본 위치에 대한 자세한 내용은이 링크를 참조하십시오. 여전히 혼란 스러우면 빠른 k9s info
K9S가 구성을로드하는 위치를 보여줍니다. 또는 K9S_CONFIG_DIR
설정하여 K9S에 디렉토리 위치에 구성을 가져 오도록 알릴 수 있습니다.
유닉스 | 마코스 | 창 |
---|---|---|
~/.config/k9s | ~/Library/Application Support/k9s | %LOCALAPPDATA%k9s |
참고 : 이것은 여전히 플럭스에 있으며 사전 방출 단계에서 변경됩니다!
이제 모든 클러스터를 무시할 수있는 ENV 변수를 설정하여 컨텍스트 포트 포워드 기본 주소 구성을 무시할 수 있습니다 K9S_DEFAULT_PF_ADDRESS=abcd
# $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는 Kubernetes 클러스터 소독제 인 Popeye와의 통합을 가지고 있습니다. Popeye 자체는 spinach.yml
이라는 구성을 사용하지만 K9S와 통합 할 때 클러스터 별 파일은 이름 $XDG_CONFIG_HOME/share/k9s/clusters/clusterX/contextY/spinach.yml
이어야합니다. 이를 통해 클러스터마다 다른 시금치 구성을 가질 수 있습니다.
주어진 클러스터에서 Nodeshell 기능 게이트를 활성화하면 K9S를 사용하면 클러스터 노드에 껍질을 벗길 수 있습니다. 일단 활성화되면 노드 뷰에있는 동안 shell
메뉴 옵션을위한 새 s
있습니다. K9S는 특수 K9S_SHELL 포드를 사용하여 선택된 노드에서 포드를 시작합니다. 또한 좋아하는 쉘 도구와 함께로드 된 사용자 정의 Docker 이미지를 사용하여 쉘 포드를 개선 할 수 있습니다. 기본적으로 K9는 BusyBox 이미지를 사용하지만 다음과 같이 구성 할 수 있습니다.
또는 K9S_FEATURE_GATE_NODE_SHELL=true|false
사용하여 모든 클러스터 노드 쉘 게이트를 무시할 수있는 ENV 변수를 설정하여 컨텍스트 구성을 재정의 할 수 있습니다.
# $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
입력하여 해당 명령을 활성화 할 수 있습니다.
명령 모드를 입력하고 리소스 이름 또는 별칭을 입력하면 자주 사용되는 리소스를 통해 자연 스러울 수 있습니다. 우리는 사용자가 자신의 키 조합을 정의하여 좋아하는 리소스보기를 활성화 할 수있는 핫키를 소개합니다.
또한 $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
너무 뜨겁지 않습니까? 사용자 정의 핫키가 도움말보기에 나열됩니까 ?
. 또한 핫키 파일이 자동으로 다시로드되므로 핫키를 정의 할 때 핫키를 쉽게 사용할 수 있습니다.
표준 K9S 바로 가기 목록의 일부가 아닌 경우, 귀하에게 적합한 키보드 바로 가기를 선택할 수 있습니다.
마찬가지로, 핫키에서 환경 변수를 참조하는 것도 지원됩니다. 사용 가능한 환경 변수는 플러그인 섹션의 설명을 참조 할 수 있습니다.
참고 :이 기능/구성은 향후 릴리스에서 변경 될 수 있습니다!
V0.25.0 기준으로 FastForwards
기능을 활용하여 K9에게 포트 포워드를 기본적으로 알려주는 방법을 알려줄 수 있습니다. 여러 컨테이너 나 컨테이너를 다수의 포트를 노출시키는 상황에서는 대부분의 경우 대화 상자에서 원하는 포트 포워드를 지정하는 것이 번거 롭습니다. 이미 어떤 컨테이너/포트 튜플을 원하는지 알고 있습니다. 이러한 사용 사례의 경우 이제 다음과 같은 주석으로 매니페스트에 주석을 달 수 있습니다.
@ k9scli.io/auto-port-forwards
포트-포워드 대화 상자를 모두 함께 우회하여 하나 이상의 포트-포워드를 활성화합니다. @ k9scli.io/port-forwards
포트-포워드 대화 상자를 시작할 때 하나 이상의 포트-포워드를 사전 선택합니다.
주석 값은 Shape 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)bozo
매핑 로컬 포트 9090-> 8080 해변에서 몰래 캐스트 v0.17.0! - 예! 소리가 빨라지지만 어떤 설정입니다!
사용자 정의 뷰를 통해 주어진 리소스에 대해 표시되는 열을 변경할 수 있습니다. 이 기능을 표현하려면 새 구성 파일, 즉 $XDG_CONFIG_HOME/k9s/views.yaml
을 만들어야합니다. 이 파일은 GVR (그룹/버전/리소스)을 활용하여 관련 테이블보기 열을 구성합니다. 보기에 대한 GVR이 발견되지 않으면 기본 렌더링이 인수됩니다 (예 : 현재 우리가 가진 것). 넓게 가면 사용자 정의 열에 주어진 리소스에서 사용할 수있는 나머지 열이 추가됩니다. 부팅하려면 뷰 구성 파일을 편집하고 리소스 뷰를 라이브로 조정할 수 있습니다!
참고 : 이것은 실험적이며 우리가 이것을 다림질 할 때 변화 될 가능성이 높습니다!
다음은 포드 및 서비스보기를 사용자 정의하는 샘플보기 구성입니다.
# $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-
에 의해 접두사해야합니다! Curly Braces는 다른 문자열 내에 환경 변수를 포함시키는 데 사용하거나 열 이름에 특수 문자가 포함 된 경우에 사용될 수 있습니다. (예 : ${NAME}-example
또는 ${COL-%CPU/L}
)
ctrl-l
바로 가기로 사용하여 선택한 포드에서 로그를 볼 수있는 플러그인을 정의합니다.
# $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
참고 : 이것은 실험적인 기능입니다! 이 기능이 강화됨에 따라 향후 K9S 릴리스에서 옵션 및 레이아웃이 변경 될 수 있습니다.
K9S는 훌륭하고 재능있는 Jaana Dogan의 Hey를 통합합니다. Hey
AB 벤치와 유사한 HTTP 엔드 포인트를 벤치마킹하는 CLI 도구입니다. 이 예비 기능은 현재 벤치마킹 포트 포워드 및 서비스를 지원합니다 (페인트를 읽으십시오.
포트 포워드를 설정하려면 포드 뷰로 이동하려면 포드와 주어진 포트를 노출시키는 컨테이너를 선택해야합니다. SHIFT-F
사용 대화 상자가 나타나면 로컬 포트를 전달할 수 있습니다. 인정되면 활성 포트 포워드를 나열하는 PortForward View (Alias pf
)로 이동할 수 있습니다. 포트 포워드를 선택하고 CTRL-B
사용하면 해당 HTTP 엔드 포인트에서 벤치 마크가 실행됩니다. 벤치 마크 실행 결과를 보려면 벤치 마크 뷰 (별칭 be
)로 이동하십시오. 이제 벤치 마크를 선택하고 <ENTER>
눌러 실행 통계 세부 정보를 볼 수 있어야합니다. 참고 : 포트-포워드는 K9S 세션 기간 동안 만 지속되며 출구시 종료됩니다.
처음에 벤치 마크는 다음 기본값으로 실행됩니다.
PortForward보기는 새로운 K9S 구성 파일, 즉 $XDG_DATA_HOME/k9s/clusters/clusterX/contextY/benchmarks.yaml
로 뒷받침됩니다. 연결하는 각 클러스터에는 클러스터의 K8S 컨텍스트 이름이 포함 된 자체 벤치 구성 파일이 있습니다. 이 파일의 변경 사항은 벤치 마크를 실행하는 방법을 나타내려면 포트 포워드보기를 자동으로 업데이트해야합니다.
벤치 마크 결과 보고서는 $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
예 : 드라큘라 피부;)
당신은 자신의 모양과 스타일을 기반으로 K9를 스타일링 할 수 있습니다. 스킨은 YAML 파일로, 사용자가 K9S 프리젠 테이션 계층을 변경할 수 있습니다. 예제는이 Repo skins
디렉토리를 참조하십시오. UI.Skin 속성을 지정하여 기본적으로 K9S를 피부에 올릴 수 있습니다. 연결하는 컨텍스트에 따라 K9S 스킨을 변경할 수도 있습니다. 이 경우 클러스터 구성 AKA skin: dracula
(확장이없는 피부 파일의 이름 만)에 스킨 필드를 지정 하고이 repo skins/dracula.yaml
$XDG_CONFIG_HOME/k9s/skins/
directory로 복사 할 수 있습니다.
클러스터가 여러 컨텍스트에 걸쳐있는 경우 컨텍스트 구성에 피부 컨텍스트 구성을 추가 할 수 있습니다. 이것은 {context_name, skin} 튜플 모음입니다 (아래 예를 참조하십시오!)
색상은 이름이나 16 진수를 사용하여 정의 할 수 있습니다. 최근에, 우리는 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
루트 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는 아마도 폭발 할 가능성이 높습니다.
K9S는 많은 오픈 소스 프로젝트 및 라이브러리 위에 있습니다. 이 프로젝트를 현실로 만들기 위해 밤과 주말을 일하는 모든 OSS 기고자들에게 진심으로 감사합니다!
Fernand Galiana
Aleksei Romanenko
우리는 항상 우리의 일을 통해 혜택을받는 사람들의 의견을 즐깁니다!
© 2023 Imhotep Software LLC. Apache v2.0에 따라 라이센스가 부여 된 모든 자료