k9s plugin 세팅하는 법 (feat. nodeshell 활성화)
plugin을 포함한 관련 설정들 어디에?
k9s 홈페이지의 플러그인 설정 설명이 좀 별로다.$XDG_CONFIG_HOME
을 자꾸 기준으로 하는데, 환경변수에서 출력한다고 바로 나오는 경로도 아니라서 한참을 해매었다.
어떤 문서들에서는 ~/.config/k9s
라고도 하고
결론부터 이야기 하면 내 현재 k9s 버전을 기준으로 유효한 설정 경로를 찾으려면 아래 명령어를 냅다 갈기면 관련 설정 위치를 다 찾을 수 있다.
k9s info
내 mac os에서 k9s 0.32.7 버전을 기준으로는 이렇게 나온다.
____ __.________
| |/ _/ __ \______
| < \____ / ___/
| | \ / /\___ \
|____|__ \ /____//____ >
\/ \/
Version: v0.32.7
Config: /Users/yeom/Library/Application Support/k9s/config.yaml
Custom Views: /Users/yeom/Library/Application Support/k9s/views.yaml
Plugins: /Users/yeom/Library/Application Support/k9s/plugins.yaml
Hotkeys: /Users/yeom/Library/Application Support/k9s/hotkeys.yaml
Aliases: /Users/yeom/Library/Application Support/k9s/aliases.yaml
Skins: /Users/yeom/Library/Application Support/k9s/skins
Context Configs: /Users/yeom/Library/Application Support/k9s/clusters
Logs: /Users/yeom/Library/Application Support/k9s/k9s.log
Benchmarks: /Users/yeom/Library/Application Support/k9s/benchmarks
ScreenDumps: /Users/yeom/Library/Application Support/k9s/screen-dumps
nodeshell
이게 또 진짜 별로다.
nodeshell 활성화 하려면 두가지 설정을 건드려줘야 한다.
- config.yaml (전역설정 파일)
- clusters/clusterX/$클러스터명/config.yaml (클러스터별 설정)
config 파일에서는 노드쉘 할 때 띄울 pod의 스펙을 적어주고, 클러스터별 설정파일에서 아래와 같이 featureGates
값을 조정해서 기능을 활성화 해줘야한다.
#뭐시기 따시기
...
featureGates:
nodeShell: true # => enable nodeShell for this context. Defaults to false
근데 이렇게 하려면 클러스터 여러개 관리하는 입장에서 계속 추가하고 바꿔줘야하는데, 생각만 해도 피곤하다.
그래서 내가 사용하는 대안은 kvaps의 kubectl-node-shell cli를 서드파티로 활용해서 k9s 플러그인으로 쓰는 방법이다.
우선 kubectl-node-shell을 설치해주고
curl -LO https://github.com/kvaps/kubectl-node-shell/raw/master/kubectl-node_shell
chmod +x ./kubectl-node_shell
sudo mv ./kubectl-node_shell /usr/local/bin/kubectl-node_shell
plugin.yaml 파일에 아래와 같이 추가해준다.
# cat ~/.config/k9s/plugins.yaml
plugins:
kubectl-node_shell:
shortCut: Ctrl-N
confirm: false
description: "Shell <node_shell>"
scopes:
- node
command: kubectl-node_shell
background: false
args:
- $NAME
그럼 이렇게 ctrl-n 으로 단축키로 해서 node shell 뚝딱 가능이다.
끝
반응형