Home

Awesome

kubetui

Release Test

Kubetui is a terminal user interface (TUI) tool designed for monitoring Kubernetes resources.
It provides an easy-to-use interface for developers and operators to access important information about their applications and infrastructure.

<details> <summary>Table of Contents</summary> </details>

Demo

<details> <summary>Demo slow version</summary>

Demo slow version

</details>

Features

Kubetui offers the following features to help you monitor and manage your Kubernetes resources:

Overall, kubetui is a powerful tool designed to provide a safe and efficient way to access and monitor your Kubernetes resources. With its user-friendly interface and comprehensive features, it simplifies the process of managing your applications and infrastructure.

Installation

Packaging status

To install kubetui, you can use the following methods:

Homebrew on macOS and Linux

Kubetui is available on homebrew, the package manager for macOS and Linux. Install it by running the following command:

brew install kubetui

Pacman on Arch Linux

Kubetui is available in the official repositories. Install it by running the following command:

pacman -S kubetui

Scoop on Windows

If you are using Windows with scoop, you can add the necessary buckets and install kubetui with the following commands:

# Add the 'extras' bucket for vcredist2022
scoop bucket add extras
scoop bucket add <bucket> https://github.com/sarub0b0/scoop-bucket
scoop install <bucket>/kubetui

WinGet on Windows

If you prefer using winget, the Windows package manager, you can install kubetui with the following command:

winget install kubetui

Chocolatey on Windows

Kubetui is available on Chocolatey, the package manager for Windows. Install it by running the following command:

choco install kubetui

openSUSE Tumbleweed

For openSUSE Tumbleweed, you can install kubetui using the zypper package manager. Run the following command to install:

zypper install kubetui

Using cargo install

Kubetui is available on crates.io, the official Rust package registry. Install it by running the following command:

cargo install kubetui

Make sure you have Rust and Cargo installed before running the command.

Downloading the binary

Alternatively, you can download the precompiled binary from the GitHub Release page that matches your operating system. Once downloaded, you can run the binary directly without any additional installation steps.

Choose the method that suits your needs and preferences.

Usage

kubetui
$ kubetui -h
kubernetes terminal user interface

Usage: kubetui [OPTIONS]

Options:
  -h, --help                           Print help information
  -V, --version                        Print version information
  -A, --all-namespaces[=<true|false>]  Select all namespaces [default: false]
  -c, --context <CONTEXT>              Context
  -C, --kubeconfig <KUBECONFIG>        kubeconfig path
  -l, --logging                        Logging
  -n, --namespaces <NAMESPACES>        Namespaces (e.g. -n val1,val2,val3 | -n val1 -n val2 -n val3)
  -s, --split-mode <v|h>               Window split mode [possible values: v, h, vertical, horizontal]

Log Query

The Log Query feature empowers you to retrieve logs from multiple Pods and their containers. Using regular expressions, selectors, and specified resources, you can precisely define the log retrieval targets. This functionality also allows you to filter logs using regular expressions, providing a powerful and flexible log querying experience.

Usage Example

pod:app container:nginx log:401

When entering ? or help in the log query form, the help popup will be displayed.

Supported Queries

QueryAliasDescription
pod:<regex>pods, po, pInclude Pods that match the regular expression in log retrieval target.
!pod:<regex>!pods, !po, !pExclude Pods that match the regular expression from log retrieval target. Can be defined multiple times.
container:<regex>containers, co, cInclude containers that match the regular expression in log retrieval target.
!container:<regex>!containers, !co, !cExclude containers that match the regular expression from log retrieval target. Can be defined multiple times.
log:<regex>logs, lo, lRetrieve logs that match the regular expression. Can be defined multiple times.
!log:<regex>!logs, !lo, !lExclude logs that match the regular expression. Can be defined multiple times.
label:<selector>labelsInclude Pods with labels matching the selector in log retrieval target. Cannot be specified with resource.
field:<selector>fieldsInclude Pods with fields matching the selector in log retrieval target.
<resource>/<name>Include Pods belonging to the specified resource in log retrieval target. Cannot be specified with label.

Supported resources:

ResourceAlias
podpo, pods
replicasetrs, replicasets
deploymentdeploy, deployments
statefulsetsts, statefulsets
daemonsetds, daemonsets
jobjobs
servicesvc, services

Query String Escaping

When including spaces in queries such as <regex> or <selector>, enclose the string with " or '. For example:

pod:"a b"
label:"environment in (production, qa)"

If you use ", ', or \ within the quoted string, escape them with \. For example:

pod:"a\\b"
<details> <summary>Query Syntax</summary>
**Lexer and Parser**

LOG_QUERIES = QUERY ( " "+ QUERY )*

QUERY = POD
        | EXCLUDE_POD
        | CONTAINER
        | EXCLUDE_CONTAINER
        | LOG
        | EXCLUDE_LOG
        | LABEL
        | FIELD
        | SPECIFIED_RESOURCE

POD = ( "pods" | "pod" | "po" | "p" ) ":" REGEX
EXCLUDE_POD = "!" POD

CONTAINER = ( "containers" | "container" | "co" | "c" ) ":" REGEX
EXCLUDE_CONTAINER = "!" CONTAINER

LOG = ( "logs" | "log" | "lo" | "l" ) ":" REGEX
EXCLUDE_LOG = "!" LOG

REGEX = QUOTED_STRING | UNQUOTED_STRING

LABEL = ( "labels" | "label" ) ":" SELECTOR
FIELD = ( "fields" | "field" ) ":" SELECTOR

SELECTOR = QUOTED_STRING | UNQUOTED_STRING

SPECIFIED_RESOURCE = RESOURCE "/" NAME

RESOURCE = ( "pods" | "pod" | "po" )
           | ( "replicasets" | "replicaset" | "rs" )
           | ( "deployments" | "deployment" | "deploy" )
           | ( "statefulsets" | "statefulset" | "sts" )
           | ( "daemonsets" | "daemonset" | "ds" )
           | ( "services" | "service" | "svc" )
           | ( "jobs" | "job" )

NAME = ALPHANUMERIC ( ALPHANUMERIC | "-" | "." )* ALPHANUMERIC

UNQUOTED_STRING = ~['" \t\r\n] ( ~[ \t\r\n] )* // without spaces

QUOTED_STRING = "\"" ESCAPED_STRING "\"" | "'" ESCAPED_STRING "'"

ESCAPED_STRING = ( ESCAPED_CHAR | ~[\"'] )\*

ESCAPED_CHAR = "\\" | "\"" | "\'"
</details>

Key Bindings

General

KeyDescription
<kbd>h</kbd>, <kbd>?</kbd>Open the popup for help
<kbd>Enter</kbd>Select an item and trigger an event
<kbd>n</kbd>Open the popup for selecting the namespace
<kbd>N</kbd>Open the popup for selecting multiple namespaces
<kbd>c</kbd>Open the popup for selecting the context
<kbd>y</kbd>Open the popup for yaml
<kbd>Tab</kbd>, <kbd>Shift+Tab</kbd>Change the focus of the view within the active tab
<kbd>number</kbd>Switch to the tab (number: 1~6)
<kbd>ESC</kbd>Close the window or terminate the app (when the popup is not open)
<kbd>q</kbd>Terminate the app
<kbd>f</kbd>Open the popup for selecting multiple API resources
<kbd>Shift+s</kbd>Toggle the split direction between vertical and horizontal

Key Map

SourceDestination
<kbd>Ctrl+p</kbd><kbd>Up</kbd>
<kbd>Ctrl+n</kbd><kbd>Down</kbd>
<kbd>Ctrl+f</kbd><kbd>Right</kbd>
<kbd>Ctrl+b</kbd><kbd>Left</kbd>
<kbd>Ctrl+u</kbd><kbd>PgUp</kbd>
<kbd>Ctrl+d</kbd><kbd>PgDn</kbd>
<kbd>Ctrl+h</kbd>, <kbd>Backspace</kbd><kbd>Delete</kbd>
<kbd>Ctrl+a</kbd><kbd>Home</kbd>
<kbd>Ctrl+e</kbd><kbd>End</kbd>
<kbd>Ctrl+[</kbd><kbd>Esc</kbd>

View Control

KeyDescription
<kbd>j</kbd>, <kbd>k</kbd>, <kbd>Down</kbd>, <kbd>Up</kbd>, <kbd>PgDn</kbd>, <kbd>PgUp</kbd>Change the selected item / Scroll the view
<kbd>Left</kbd>, <kbd>Right</kbd>Scroll horizontally in the view
<kbd>g</kbd>Go to the first item / Go to the top of the view
<kbd>G</kbd>Go to the last item / Go to the bottom of the view

Text View

KeyDescription
<kbd>/</kbd>Activate search mode and open the search form
<kbd>Enter</kbd>Confirm the input
<kbd>q</kbd>, <kbd>Esc</kbd>Disable search mode and close the search form (when search mode is active)

Search Mode

KeyDescription
<kbd>n</kbd>, <kbd>N</kbd>Go to the next / previous match
<kbd>q</kbd>, <kbd>Esc</kbd>Disable search mode

Table View

KeyDescription
<kbd>/</kbd>Open the filter form
<kbd>Enter</kbd>, <kbd>ESC</kbd>Close the filter form

Popup

KeyDescription
<kbd>Down</kbd>, <kbd>Up</kbd>, <kbd>PgDn</kbd>, <kbd>PgUp</kbd>Change the selected item / Scroll the view
<kbd>Tab</kbd>, <kbd>Shift+Tab</kbd>Change the focus of the view within the active tab
<kbd>Enter</kbd>Select an item and trigger an event
<kbd>ESC</kbd>Close the window or terminate the app (when the popup is not open)

Input Form

KeyDescription
<kbd>Home</kbd>Move the cursor to the beginning
<kbd>End</kbd>Move the cursor to the end
<kbd>Ctrl+w</kbd>Delete text from the cursor to the beginning
<kbd>Ctrl+k</kbd>Delete text from the cursor to the end
<kbd>Left</kbd>, <kbd>Right</kbd>Move the cursor to the previous / next character

Contributing

Bug reports and pull requests are welcome.

License

This software is available as open source under the terms of the MIT License.