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)

There is currently no good solution. If you must use kop on a physical terminal, one compromise is kmscon.

Kmscon is a simple terminal emulator based on linux kernel mode setting (KMS). It is an attempt to replace the in-kernel VT implementation with a userspace console. See https://github.com/kmscon/kmscon

Roadmap

Features

  • Upload local files to pod containers
  • Download files from pod containers to local
  • Multi-task workspace 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.0b1.tar.gz (13.0 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.0b1-py3-none-any.whl (120.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kop_cli-0.1.0b1.tar.gz
  • Upload date:
  • Size: 13.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kop_cli-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 9756202a64a0fc4b131a63a64acb7d5584998100841d4e3109bb36493e6e3235
MD5 3b44c4e82d19cb8e70c497f997cb9a09
BLAKE2b-256 a2b27ecd9718d0b1f151f0bff8d824e057f1a2b5bce7defd4d572760c388d946

See more details on using hashes here.

Provenance

The following attestation bundles were made for kop_cli-0.1.0b1.tar.gz:

Publisher: python-publish.yml on vegaoqiang/kop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: kop_cli-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 120.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kop_cli-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 53ed974c3a3fac04fcae75f71d34a02253bf66da42748569505c96713166004a
MD5 1bda1b0c4193f7aaa73074d195951199
BLAKE2b-256 c9ed68342e6d44dced82fcfbdcf5ff2cee60a70668cc0d790e9e4f58ce508598

See more details on using hashes here.

Provenance

The following attestation bundles were made for kop_cli-0.1.0b1-py3-none-any.whl:

Publisher: python-publish.yml on vegaoqiang/kop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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