Skip to main content

Terminal-based kubernetes operation platform

Project description

sample

PyPI version PyPI - Python Version OS support

kop

kop is a terminal-based (TUI) Kubernetes operations platform. Its goal is to provide an interactive experience similar to desktop cluster management tools, but fully within the terminal command line, aiming to solve the problem of conveniently operating Kubernetes clusters when no desktop environment is available.

Requirements

  • Python >=3.9
  • Terminal environment with TUI support (TrueColor/xterm-256color/Mouse Tracking)

Installation

pip install kop-cli

After installation, you can directly run:

kop --version

Usage

1. Startup

kop

By default, it will load:

  • ~/.kube/config (if it exists)
  • kubeconfig files already synced under ~/.kop/

If no available cluster is found, you can import configuration from the startup page via Add or Sync.

2. Start with a Specified kubeconfig

kop --kubeconfig /path/to/kubeconfig.yaml

In this mode, the file path and kubeconfig validity are verified, and after validation it enters the resource view directly.

Operations and Shortcuts

See demo video: Watch the demo

Please refer to the Documentation for more detailed usage instructions.

Startup Page (Cluster List)

  • a: Add cluster
  • c / Enter: Connect to cluster
  • d: Delete cluster
  • e: Edit cluster
  • s: Sync local kubeconfig
  • Arrow keys ↑↓←→: Move between cluster cards

Resource Page

  • Select resource type from the left-side menu
  • ]: Quickly focus the namespace selector
  • /: Search (menu or resources)
  • c: Create resource (when supported by the current resource type)
  • Esc: Return to cluster home page

Tip: Available actions differ by resource in the details/operation panel. The bottom of the interface shows available key hints.

FAQ

Mouse click not working

When using iTerm2 on macOS to SSH into a remote host and run kop, mouse clicks may not work. This happens because in Linux environments, most command-line programs rely on the $TERM variable to determine terminal capabilities (such as colors and bold text). A common value is xterm-256color. While xterm-256color is a general standard, it does not cover all extensions of modern terminals (such as advanced mouse protocols or synchronized updates). Textual is a very advanced TUI (text user interface) framework. To provide the best experience, it tries to detect which terminal is actually running. For iTerm2, it supports many non-standard advanced features. Textual has internal optimization logic: when it detects TERM_PROGRAM=iTerm.app, it switches to an interaction mode optimized for iTerm2. If Textual does not see TERM_PROGRAM=iTerm.app, it may avoid enabling some advanced interaction features, or due to configuration conflicts, it may fail to properly fall back to a generic mouse mode.

Solutions:

  1. Manually run export TERM_PROGRAM=iTerm.app on the remote host. After restarting kop, mouse clicks should work normally.
  2. Update local SSH config on macOS: ~/.ssh/config, add:
Host *
    SendEnv TERM_PROGRAM

Update remote host sshd config: /etc/ssh/sshd_config, add:

AcceptEnv TERM_PROGRAM

After restarting the sshd service, disconnect and reconnect to the remote host, then run kop again. Mouse clicking should be restored.

Why doesn't kop look good on macOS?

kop is built with Textual for terminal UI. Please refer to the Textual FAQ section about display issues in the default macOS terminal for fixes: https://textual.textualize.io/FAQ/#why-doesnt-textual-look-good-on-macos

Abnormal display on Linux console

You may use kop on Linux console (a monitor connected to a server via a VGA cable) and find kop UI rendering issues or even crashes. This is because Linux kernel built-in virtual terminals (tty1~tty6):

  • ❌ Do not support True Color (24-bit)
  • ❌ Do not support 256 colors
  • ✅ Only support 16 colors (sometimes even only 8)
  • ✅ Rendering is controlled by the kernel (not by a terminal emulator)

see font-for-textual for solution.

Roadmap

Features

  • Upload local files to pod containers
  • Download files from pod containers to local
  • Multi-task window support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kop_cli-0.1.0a6.tar.gz (11.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kop_cli-0.1.0a6-py3-none-any.whl (110.9 kB view details)

Uploaded Python 3

File details

Details for the file kop_cli-0.1.0a6.tar.gz.

File metadata

  • Download URL: kop_cli-0.1.0a6.tar.gz
  • Upload date:
  • Size: 11.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.13 HTTPX/0.28.1

File hashes

Hashes for kop_cli-0.1.0a6.tar.gz
Algorithm Hash digest
SHA256 26290f3e269383db08cb1404be81a93ca7af16a09b7f41b2e27f13825e92692d
MD5 b0558e251028f26c7fb904b79111d6b5
BLAKE2b-256 7e4fb51d844b0b8d70e68a9c2069f7bf4ace373f8f5cf7415264a281f19c956d

See more details on using hashes here.

File details

Details for the file kop_cli-0.1.0a6-py3-none-any.whl.

File metadata

  • Download URL: kop_cli-0.1.0a6-py3-none-any.whl
  • Upload date:
  • Size: 110.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.13 HTTPX/0.28.1

File hashes

Hashes for kop_cli-0.1.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 fdf3b8f075f08d86562c246a2f24ace5b5dae1e2030335a0ac6b9231e06ad816
MD5 c5a43419ef6ab616a4dba8fef1d8bb44
BLAKE2b-256 fe8bb1f70999b4e0ec8d999a19ed610201b0623c5995b41118ba457d9ececaa8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page