forked from yangpeng14/DevOps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yangpeng
committed
Oct 13, 2021
1 parent
808f39a
commit 9381e61
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## kubecolor 带有色彩输出 | ||
|
||
- 获取 kubernetes node 节点信息 | ||
|
||
![](../img/95733375-04929680-0cbd-11eb-82f3-adbcfecf4a3e.png) | ||
|
||
- 显示 kubernetes pods 详细信息 | ||
|
||
![](../img/95733389-08beb400-0cbd-11eb-983b-cf5138277fe3.png) | ||
|
||
- 更换背影颜色主题 | ||
|
||
![](../img/95733403-0c523b00-0cbd-11eb-9ff9-abc5469e97ca.png) | ||
|
||
从上面来看,带有色彩输出比没有带色彩输出看的更舒服些。 | ||
|
||
## Kubecolor 如何运行? | ||
|
||
kubecolor 为 kubectl 命令输出着色,不执行任何其他操作。kubecolor 在内部调用 `kubectl command` 并尝试对输出进行着色。 | ||
|
||
## Kubecolor 安装 | ||
|
||
- 二进制文件安装 | ||
|
||
打开 `https://github.com/dty1er/kubecolor/releases` 页面,下载相应的二进制文件,下载文件后,把文件放到 `/usr/local/bin` 目录下,并把文件添加执行权限。 | ||
|
||
- Mac 安装 | ||
|
||
```bash | ||
$ brew install dty1er/tap/kubecolor | ||
``` | ||
|
||
## Kubecolor 用法 | ||
|
||
如果习惯使用 kubectl,可以把 kubecolor 命令做一个 kubectl 别名。具体在 .bash_profile 文件中配置,下面是具体配置。kubecolor 使用和 kubectl 命令方法一样。 | ||
|
||
```bash | ||
alias kubectl="kubecolor" | ||
``` | ||
|
||
当 kubecolor 输出 tty 不是标准输出时,它会自动禁用着色。例如,如果您正在运行 `kubecolor get pods > result.txt` 或 `kubecolor get pods | grep xxx`,则输出将传递到文件或其它命令,因此不会着色。在这种情况下,您可以通过传递 `--force-colors` 标志来强制 kubecolor 进行着色。 |