k9s: 管理 Kubernetes 集群的 cli

发布时间: 更新时间: 总字数:547 阅读时间:2m 作者: IP上海 分享 网址

k9s 提供了与 kubernetes 集群交互的终端用户界面。该项目的目的是让使用者更轻松地浏览、观察和管理野生应用程序。

安装

k9s 支持 kubernetes 版本说明

# snap
snap install k9s --devmode

# go 源码安装
go install github.com/derailed/k9s@latest

或直接到 https://github.com/derailed/k9s/releases 下载二进制文件

Key Bindings

ActionCommandComment
Show active keyboard mnemonics and help?
Show all available resource aliasctrl-a
To bail out of K9s:q, ctrl-c
View a Kubernetes resource using singular/plural or short-name:pod⏎accepts singular, plural, short-name or alias ie pod or pods
View a Kubernetes resource in a given namespace:pod ns-x⏎
View filtered pods (New v0.30.0!):pod /fred⏎View all pods filtered by fred
View labeled pods (New v0.30.0!):pod app=fred,env=dev⏎View all pods with labels matching app=fred and env=dev
View pods in a given context (New v0.30.0!):pod @ctx1⏎View all pods in context ctx1. Switches out your current k9s context!
Filter out a resource view given a filter/filter⏎Regex2 supported ie `fred
Inverse regex filter/! filter⏎Keep everything that doesn’t match.
Filter resource view by labels/-l label-selector⏎
Fuzzy find a resource given a filter/-f filter⏎
Bails out of view/command/filter mode<esc>
Key mapping to describe, view, edit, view logs,…d,v, e, l,…
To view and switch to another Kubernetes context (Pod view):ctx⏎
To view and switch directly to another Kubernetes context (Last used view):ctx context-name⏎
To view and switch to another Kubernetes namespace:ns⏎
To view all saved resources:screendump or sd⏎
To delete a resource (TAB and ENTER to confirm)ctrl-d
To kill a resource (no confirmation dialog, equivalent to kubectl delete –now)ctrl-k
Launch pulses view:pulses or pu⏎
Launch XRay view:xray RESOURCE [NAMESPACE]⏎RESOURCE can be one of po, svc, dp, rs, sts, ds, NAMESPACE is optional
Launch Popeye view:popeye or pop⏎See popeye

使用

# 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

删除 k8s Terminating 资源

  • 错误来自
  • namespace 处于 Terminating 强制删除,选中资源,点击 k9s e
  finalizers:
  - wrangler.cattle.io/auth-prov-v2-crole

参考

  1. https://github.com/derailed/k9s
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数