kubetui logo

kubetui kosay

Use this command to install kubetui:
winget install --id=kosay.kubetui -e

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.

README

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.

Table of Contents

Demo

Demo slow version

Demo slow version

Features

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

  • Pods List and Container Logs:
    • View a list of pods and their container logs.
    • JSON logs display mode switching: toggle between pretty print and single-line display using the f or p keys.
    • (new) Customizable pod columns: Use --pod-columns to control which columns are shown in the pod table view. Supports comma-separated lists or full to show all columns.
  • ConfigMap and Secret Watching: Monitor ConfigMaps and secrets, and decode their data.
  • Network-related Resources: Explore a list of network-related resources and their descriptions.
  • Events Watching: Stay updated with a real-time view of Kubernetes events.
  • Specific Resources Watching (List / YAML): View specific resources in list or YAML format.
  • Namespace Multiple Selections: Select and view multiple namespaces simultaneously.
  • Context Selection: Change the Kubernetes context you want to operate on.
  • Clipboard Support (Text Copy): Copy text conveniently using mouse actions.
  • Mouse Event Support: Leverage mouse events for a smoother user experience.
  • Search Functionality: Easily search for specific keywords within the interface.
  • Item Filtering: Filter items based on multiple keywords separated by spaces.
  • (beta) Customizable UI Appearance: Modify the appearance of the UI, including border styles, colors, and text attributes.

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  https://github.com/sarub0b0/scoop-bucket
scoop install /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
An intuitive Terminal User Interface (TUI) tool for real-time monitoring and exploration of Kubernetes resources.

Usage: kubetui [OPTIONS] [COMMAND]

Commands:
  completion  Generate completion script

Options:
  -h, --help                           Print help
  -V, --version                        Print version
  -A, --all-namespaces[=]  Select all namespaces [default: false]
  -c, --context               Context
  -C, --kubeconfig         kubeconfig path
      --config-file       Config file path
  -l, --logging                        Logging
  -n, --namespaces         Namespaces (e.g. -n val1,val2,val3 | -n val1 -n val2 -n val3)
      --pod-columns       Comma-separated list of columns to show in pod table (e.g. name,status,ip). Use "full" to show all available columns [default: name,ready,status,age]
  -s, --split-direction           Window split direction [default: v]

Pod Column Customization

Use --pod-columns to customize the columns displayed in the pod table.

  • Specify columns using a comma-separated list:
    --pod-columns=ready,status,age

  • Use full to show all available columns:
    --pod-columns=full

Notes:

  • The Name column is always included even if not specified.
  • The full keyword cannot be combined with other columns.

Shell Completion

Kubetui supports shell completion for Bash and Zsh. You can enable the completion by adding the following to your shell configuration file:

For Bash (add to ~/.bashrc or ~/.bash_profile):

source <(kubetui completion bash)

For Zsh (add to ~/.zshrc):

source <(kubetui completion zsh)

Custom Configuration

You can customize the UI appearance by specifying a configuration file using the --config-file flag:

kubetui --config-file /path/to/your/config.yaml

The configuration file can also be located at ~/.config/kubetui/config.yaml or $XDG_CONFIG_FILE/kubetui/config.yaml.

The configuration file allows you to modify various aspects of the UI, including:

  • Border Styles: Customize the border styles of different UI components.
  • Colors: Change the colors of text, backgrounds, and borders.
  • Text Attributes: Modify text attributes such as bold, italic, and underline.

A sample configuration file is available at examples/config.yaml to help you get started with customizing the UI.

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 dialog will be displayed.

Supported Queries

QueryAliasDescription
pod:\pods, po, pInclude Pods that match the regular expression in log retrieval target.
!pod:\!pods, !po, !pExclude Pods that match the regular expression from log retrieval target. Can be defined multiple times.
container:\containers, co, cInclude containers that match the regular expression in log retrieval target.
!container:\!containers, !co, !cExclude containers that match the regular expression from log retrieval target. Can be defined multiple times.
log:\logs, lo, lRetrieve logs that match the regular expression. Can be defined multiple times.
!log:\!logs, !lo, !lExclude logs that match the regular expression. Can be defined multiple times.
label:\labelsInclude Pods with labels matching the selector in log retrieval target. Cannot be specified with resource.
field:\fieldsInclude Pods with fields matching the selector in log retrieval target.
/\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 or, 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"

Query Syntax

**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 = "\\" | "\"" | "\'"

Key Bindings

General

KeyDescription
h, ?Open the dialog for help
EnterSelect an item and trigger an event
nOpen the dialog for selecting the namespace
NOpen the dialog for selecting multiple namespaces
cOpen the dialog for selecting the context
yOpen the dialog for yaml
Tab, Shift+TabChange the focus of the view within the active tab
numberSwitch to the tab (number: 1~6)
ESCClose the window or terminate the app (when the dialog is not open)
qTerminate the app
fOpen the dialog for selecting multiple API resources
Shift+sToggle the split direction between vertical and horizontal

Key Map

SourceDestination
Ctrl+pUp
Ctrl+nDown
Ctrl+fRight
Ctrl+bLeft
Ctrl+uPgUp
Ctrl+dPgDn
Ctrl+h, BackspaceDelete
Ctrl+aHome
Ctrl+eEnd
Ctrl+[Esc

View Control

KeyDescription
j, k, Down, Up, PgDn, PgUpChange the selected item / Scroll the view
Left, RightScroll horizontally in the view
gGo to the first item / Go to the top of the view
GGo to the last item / Go to the bottom of the view

Text View

KeyDescription
/Activate search mode and open the search form
EnterConfirm the input
q, EscDisable search mode and close the search form (when search mode is active)

Search Mode

KeyDescription
n, NGo to the next / previous match
q, EscDisable search mode

Table View

KeyDescription
/Open the filter form
Enter, ESCClose the filter form

Dialog

KeyDescription
Down, Up, PgDn, PgUpChange the selected item / Scroll the view
Tab, Shift+TabChange the focus of the view within the active tab
EnterSelect an item and trigger an event
ESCClose the window or terminate the app (when the dialog is not open)

Input Form

KeyDescription
HomeMove the cursor to the beginning
EndMove the cursor to the end
Ctrl+wDelete text from the cursor to the beginning
Ctrl+kDelete text from the cursor to the end
Left, RightMove the cursor to the previous / next character

Container Logs View

KeyDescription
f, pToggle between pretty print and single-line display for JSON logs.
EnterInsert a blank line.

Contributing

Bug reports and pull requests are welcome.

License

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

Versions
1.7.1
1.7.0
1.6.2
1.6.0
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
Website
License