#kubernetes #tui #terminal #monitor

bin+lib kubetui

An intuitive Terminal User Interface (TUI) tool for real-time monitoring and exploration of Kubernetes resources

5 stable releases

1.5.0 Jan 14, 2024
1.4.2 Sep 20, 2023
1.4.1 Aug 7, 2023
1.4.0 Jul 3, 2023
1.3.0 Jun 10, 2023

#719 in Parser implementations

Download history 9/week @ 2023-10-28 7/week @ 2023-11-04 4/week @ 2023-11-11 7/week @ 2023-11-18 18/week @ 2023-11-25 10/week @ 2023-12-02 9/week @ 2023-12-09 3/week @ 2023-12-16 10/week @ 2023-12-23 5/week @ 2023-12-30 7/week @ 2024-01-06 43/week @ 2024-01-13 14/week @ 2024-01-20 22/week @ 2024-01-27 13/week @ 2024-02-03 22/week @ 2024-02-10

75 downloads per month

MIT license

765KB
21K SLoC

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

Installation

To install Kubetui, you can use the following methods:

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

    # Install with rustls version
    cargo install kubetui
    

    or

    # Install with openssl version
    cargo install kubetui --no-default-features --features openssl-tls
    

    Make sure you have Rust and Cargo installed before running the command. If you choose the OpenSSL version, you will need to have the OpenSSL library installed as well.

  2. 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.

Features

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

  • Pods List and Container Logs: Easily view a list of pods and their container logs.
  • 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.

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.

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

Query Alias Description
pod:<regex> pods, po, p Include Pods that match the regular expression in log retrieval target.
!pod:<regex> !pods, !po, !p Exclude Pods that match the regular expression from log retrieval target. Can be defined multiple times.
container:<regex> containers, co, c Include containers that match the regular expression in log retrieval target.
!container:<regex> !containers, !co, !c Exclude containers that match the regular expression from log retrieval target. Can be defined multiple times.
log:<regex> logs, lo, l Retrieve logs that match the regular expression. Can be defined multiple times.
!log:<regex> !logs, !lo, !l Exclude logs that match the regular expression. Can be defined multiple times.
label:<selector> labels Include Pods with labels matching the selector in log retrieval target. Cannot be specified with resource.
field:<selector> fields Include 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:

Resource Alias
pod po, pods
replicaset rs, replicasets
deployment deploy, deployments
statefulset sts, statefulsets
daemonset ds, daemonsets
job jobs
service svc, 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"
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

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

Key Map

Source Destination
Ctrl+p Up
Ctrl+n Down
Ctrl+f Right
Ctrl+b Left
Ctrl+u PgUp
Ctrl+d PgDn
Ctrl+h, Backspace Delete
Ctrl+a Home
Ctrl+e End
Ctrl+[ Esc

View Control

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

Text View

Key Description
/ Activate search mode and open the search form
Enter Confirm the input
q, Esc Disable search mode and close the search form (when search mode is active)

Search Mode

Key Description
n, N Go to the next / previous match
q, Esc Disable search mode

Table View

Key Description
/ Open the filter form
Enter, ESC Close the filter form

Popup

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

Input Form

Key Description
Home Move the cursor to the beginning
End Move the cursor to the end
Ctrl+w Delete text from the cursor to the beginning
Ctrl+k Delete text from the cursor to the end
Left, Right 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.

Dependencies

~83MB
~1.5M SLoC