Skip to content

Curses-based terminal UI for Kubernetes (k8s Global View)

License

Notifications You must be signed in to change notification settings

night-crawler/kgv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KGV

Rust MIT licensed

KGV is Kubernetes Global View or an acronym for GVK. It's a Terminal UI for observing and manipulating Kubernetes resources.

Features

  1. rhai-based data extraction for table views. Write a small script to extract the data for each column for a given GVK. Data extraction is parallel.
  2. Rhai module support. Use imports and reuse the code.
  3. Detail view templates are defined as Handlebars HTML templates, rendered against the resource context, and then converted to ASCII using cursive-markup.
  4. Live reloading support for the rhai engine and templates.
  5. Live updates for the detail, YAML, and list views.
  6. Collecting initial GVK resource names is cached. Startup on overprovisioned or overloaded k8s installations is faster.
  7. Multiple window support. Open multiple windows (logs, list views, list details views, or just details views) and switch between them. Switching is instant.
  8. Custom user dirs support. Specify your modules and templates dirs with CMD arguments.

Screenshots

Table View: Pods Table View: Pod Containers Handlebars HTML Detail View YAML View Window Switcher View GVK Switcher View Logs View Menu Port Forwarding Dialog Port Forwarding View

Minor features

  • Rhai debugs are transferred to the main debug window
  • Handlebars template includes and inheritance support
  • YAML partial code extractors for Handlebars (use to_yaml helper)

Hotkeys

  • ~: Show Debug Console
  • Esc: Close the current window
  • Ctrl+s: execute kubectl exec -it
  • Alt+=: Show windows view
  • Ctrl+p: Dump rhai object to temp
  • F5: Refresh the view (clears deleted items)
  • Ctrl+y: Show Resource YAML view
  • Ctrl+/: Show a list of registered GVKs
  • Ctrl+k: Delete current selected resource
  • Ctrl+l: Show logs for the selected resource
  • Ctrl+f: Show Port Forwarding dialog for the selected pod
  • Ctrl+g: Show active Port Forwards

Run

RUST_BACKTRACE=1 cargo run -- --module-dirs ./default_config/modules --extractor-dirs ./default_config/views/list  --detail-template-dirs ./default_config/views/detail

Adding new Resource / GVK support

  1. Describe the Resource List view YAML. Top-level sections are:
    • resource: there you describe Group, Version, Kind
    • imports: automatically prepend for each column evaluator script these lines
    • pseudo_resources: an extractor for nested resource list (return a list of PseudoResource items; for Pod pseudo-resource is a container)
    • events: show either a pseudo resource table or an HTML detail template
    • columns: a list of column evaluators with column names
    • details: for HTML-based views specify a root template and rhai helpers
  2. If you need an HTML detail view, describe templates. Includes and template inheritance is supported.
  3. When writing column evaluators, use Ctrl+P hotkey to extract currently selected resource as a rhai object.

TODO

  • Resource multiselect (i.e., to delete multiple resources at once)
  • Resource kill options support
  • Faster Log view
  • Better shell selector (now it uses sh always)
  • Port Forwarding
  • Configurable hotkeys
  • rhai-based context extractors for rendering with support for multiple resources (when you need to solve N+1 problem for resource detail view and show some dependencies)
  • Log mirroring to a file
  • Prepare more detail and list views for more GVKs
  • Support for popular CRDs (helm, GitOps, etc)
  • Solve a problem with panics handler breaking the terminal

About

Curses-based terminal UI for Kubernetes (k8s Global View)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published