#kubernetes #tui #watch #resources #delta #view #kubectl

app kubectl-watch

A kubectl plugin to provide a pretty delta change view of being watched kubernetes resources

12 releases

0.2.4 Aug 17, 2023
0.2.3 Feb 17, 2023
0.2.2 Oct 14, 2022
0.2.1 Sep 16, 2022
0.1.8 Sep 14, 2022

#56 in Visualization

50 downloads per month

MIT license

45KB
1K SLoC

kubectl-watch

🎉🎉🎉 Since 0.2.3 we have terminal UI.

Another watch tool with visualization view of delta change for kubernetes resources.

overview.gif

Installation

Use docker image [recommend]

  1. Docker should be preinstalled, more installation details please visit official website.

  2. Download kubectl-watch script into your $PATH folder

curl -SL# "https://github.com/imuxin/kubectl-watch/blob/master/script/kubectl-watch?raw=true" >> /usr/local/bin/kubectl-watch && chmod +x /usr/local/bin/kubectl-watch

Download kubectl-watch from release assets.

Build and install from source using Cargo:

cargo install kubectl-watch --locked

Command help

USAGE:
    kubectl-watch [OPTIONS] [ARGS]

ARGS:
    <RESOURCE>    Support resource 'plural', 'kind' and 'shortname'
    <NAME>        Resource name, optional

OPTIONS:
    -A, --all                       If present, list the requested object(s) across all namespaces
        --export <EXPORT>           A path, where all watched resources will be strored
    -h, --help                      Print help information
        --include-managed-fields    Set ture to show managed fields delta changes
    -l, --selector <SELECTOR>       Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
        --mode <MODE>               delta changes view mode [default: tui] [possible values: tui, simple]
    -n, --namespace <NAMESPACE>     If present, the namespace scope for this CLI request
        --use-tls                   Use tls to request api-server
    -V, --version                   Print version information

TUI keystroke help

Keystroke Description
char "j" or Down Arrow ↓ go to next  resource
char "k" or Up Arrow ↑ go to previous resource
Enter ↵ Only show selected resource events
ESC go back
PageUP scroll up diff content
PageDown scroll down diff content
Home reset scroll

Examples

watch deploy in all namespace

kubectl-watch deployment -A

watch deploy on some namespace

kubectl-watch deployment -n {namespace}

export watched resources into local storage, just add --export "/to/your/path"

kubectl-watch {resource} --export "/to/your/path"

managed-fields will be excluded by default, add --include-managed-fields can show the managed fields changes.

kubectl-watch {resource} -include-managed-fields

Acknowledgment

Dependencies

~86MB
~1.5M SLoC