

Kubernetes:基于终端UI的管理工具 K9s
source link: https://liruilongs.github.io/2023/01/14/%E5%BE%85%E5%8F%91%E5%B8%83/%E4%BA%8C%E6%9C%9F/%E5%85%B3%E4%BA%8EKubernetes-%E7%BB%88%E7%AB%AFIDE-K9s-%E7%9A%84%E4%B8%80%E4%BA%9B%E7%AC%94%E8%AE%B0%E6%95%B4%E7%90%86/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Kubernetes:基于终端UI的管理工具 K9s
我所渴求的,無非是將心中脫穎語出的本性付諸生活,為何竟如此艱難呢 ——赫尔曼·黑塞《德米安》
K9s
是一个基于终端UI的 K8S 管理工具- 博文内容为
k9s
在 windows、Linux 以及docker 安装Demo - 简单的 热键使用。
- 理解不足小伙伴帮忙指正
我所渴求的,無非是將心中脫穎語出的本性付諸生活,為何竟如此艱難呢 ——赫尔曼·黑塞《德米安》
K9s
是一个基于终端的管理 Kubernetes
集群的工具,旨在简化 Kubernetes
集群管理。和 kubebox
有些类似, K9s 同样可以持续监控集群的变化,并且可以提供与集群资源交互的快捷命令。如果说管理集群受限,只有一个 终端你可以使用,那么 k9s
是一个不错的选择.
K9s
有一些特殊功能,可以显示 Kubernetes 资源之间依赖关系的 xray
、显示集群高级状态的 pulse
,以及扫描和报告已部署资源和配置问题的popeye
。
window 客户端安装
PS C:\Program Files> choco install k9s
Chocolatey v1.1.0
Installing the following packages:
k9s
By installing, you accept licenses for the packages.
Progress: Downloading kubernetes-cli 1.26.0... 100%
Progress: Downloading k9s 0.26.7... 100%
kubernetes-cli v1.26.0 [Approved]
kubernetes-cli package files install completed. Performing other installation steps.
The package kubernetes-cli wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): all
Extracting 64-bit C:\ProgramData\chocolatey\lib\kubernetes-cli\tools\kubernetes-client-windows-amd64.tar.gz to C:\ProgramData\chocolatey\lib\kubernetes-cli\tools...
C:\ProgramData\chocolatey\lib\kubernetes-cli\tools
Extracting 64-bit C:\ProgramData\chocolatey\lib\kubernetes-cli\tools\kubernetes-client-windows-amd64.tar to C:\ProgramData\chocolatey\lib\kubernetes-cli\tools...
C:\ProgramData\chocolatey\lib\kubernetes-cli\tools
ShimGen has successfully created a shim for kubectl-convert.exe
ShimGen has successfully created a shim for kubectl.exe
The install of kubernetes-cli was successful.
Software installed to 'C:\ProgramData\chocolatey\lib\kubernetes-cli\tools'
k9s v0.26.7 [Approved]
k9s package files install completed. Performing other installation steps.
Extracting 64-bit C:\ProgramData\chocolatey\lib\k9s\tools\k9s_Windows_x86_64.tar.gz to C:\ProgramData\chocolatey\lib\k9s\tools...
C:\ProgramData\chocolatey\lib\k9s\tools
Extracting 64-bit C:\ProgramData\chocolatey\lib\k9s\tools\k9s_Windows_x86_64.tar to C:\ProgramData\chocolatey\lib\k9s\tools...
C:\ProgramData\chocolatey\lib\k9s\tools
ShimGen has successfully created a shim for k9s.exe
The install of k9s was successful.
Software installed to 'C:\ProgramData\chocolatey\lib\k9s\tools'
Chocolatey installed 2/2 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Program Files>
下载之后,需要准备好 kubeconfig
文件,放到默认加载的位置
PS C:\Users\山河已无恙\.kube> ls
目录: C:\Users\山河已无恙\.kube
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2023/1/14 7:48 cache
-a---- 2023/1/14 10:19 5682 config
PS C:\Users\山河已无恙\.kube> cat .\config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data:
.......................
通过命令行启动
PS C:\ProgramData\chocolatey\lib\k9s\tools> .\k9s.exe
Linux 客户端安装
下载安装包
┌──[[email protected]]-[~/ansible/k9s]
└─$curl -sS https://webinstall.dev/k9s | bash
Thanks for using webi to install 'k9s@stable' on 'Linux/x86_64'.
Have a problem? Experience a bug? Please let us know:
https://github.com/webinstall/webi-installers/issues
Lovin' it? Say thanks with a Star on GitHub:
https://github.com/webinstall/webi-installers
Downloading k9s from
https://github.com/derailed/k9s/releases/download/v0.26.7/k9s_Linux_x86_64.tar.gz
failed to download from https://github.com/derailed/k9s/releases/download/v0.26.7/k9s_Linux_x86_64.tar.gz
解压直接运行
┌──[[email protected]]-[~/ansible/k9s]
└─$tar -zxvf k9s_Linux_x86_64.tar.gz
LICENSE
README.md
k9s
┌──[[email protected]]-[~/ansible/k9s]
└─$ls
k9s k9s_Linux_x86_64.tar.gz LICENSE README.md
┌──[[email protected]]-[~/ansible/k9s]
└─$./k9s
查看当前集群资源的统计信息。
docker 安装
也可以通过docker 直接运行
┌──[[email protected]]-[~/ansible/k9s]
└─$docker run --rm -it -v ~/.kube/config:/root/.kube/config docker.io/derailed/k9s
查看资源状态信息
查看资源依赖关系
Action | Command | Comment |
---|---|---|
Show active keyboard mnemonics and help | ? |
|
Show all available resource alias | ctrl-a |
|
To bail out of K9s | :q , ctrl-c |
|
View a Kubernetes resource using singular/plural or short-name | : po⏎ |
accepts singular, plural, short-name or alias ie pod or pods |
View a Kubernetes resource in a given namespace | : alias namespace⏎ |
|
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 | : ctx⏎ |
|
To view and switch to another Kubernetes context | : 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!) | 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 |
Recommend
-
83
01概述Helm是kubernetes包管理工具,可以方便快捷的安装、管理、卸载kubernetes应用,类似于Linux操作系统中yum或apt-get软件的作用。其主要的设计目的:创建新的chart包将charts包文件打包压缩同chart仓库进行集成,获取charts文件安装及卸载charts到kubernetes集...
-
26
一,Helm基础概述1,使用Helm的目的?由之前的应用部署过程中可知,在kubernetes系统chart定义了一个pvc,申请8G的pv,由于上部署容器化应用时需要事先手动编写资源配置清单文件以定义资源对象,而且其每一次的配置定义基本上都是硬编码,基本上无法实现复用。对于...
-
28
Lens 是一个开源的管理Kubernetes集群的IDE,相比于其他的可视化管理更加好用,功能十分强大。通过 Lens,我们可以很方便的管理多个Kubernetes集群。 Lens支持MacOS, Windows...
-
14
集成容器管理工具Kubernetes,CloudStack打通任督二脉
-
15
Oppo K9s will be unveiled on October 20 Oppo laun...
-
6
一款神奇的 Shell 历史记录管理工具,支持多终端实时同步-51CTO.COM Atuin: 一款神奇的 Shell 历史记录管理工具,支持多终端实时同步 作者:atuin 2022-05-09 09:11:36 Atuin 使用 SQL...
-
5
一款超强大的 Kubernetes Pod 资源终端管理工具-51CTO.COM Kubectl-Ice: 一款超强大的 Kubernetes Pod 资源终端管理工具 作者:Marionxue 2022-05-25 16:59:27 本期介绍一个实用的Kube...
-
20
TrueNas Scale uses k3s, which is a lightweight Kubernetes distribution. It’s intended to be used only as platform for
-
7
Kubernetes:基于命名行终端/ Web 控制台的管理工具 kubebox 我所渴求的,無非是將心中脫穎語出的本性付諸生活,為何竟如此艱難呢 ——赫尔曼·黑塞《德米安》 kubebox 是一个轻量的 k8s 管理工具,可以基...
-
5
📜 引言: 磨刀不误砍柴工 工欲善其事必先利其器 第一篇:《K8S 实用工具之一 - 如何合并多个 kubeconfig?
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK