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. Default Startup (Read Local Configuration)

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

Kubernetes Version Compatibility Matrix

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 physical terminals

You may use kop on a physical terminal (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 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.0a4.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.0a4-py3-none-any.whl (109.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kop_cli-0.1.0a4.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.0a4.tar.gz
Algorithm Hash digest
SHA256 09d21cd24078f3f2566591484b8c7804a914c7570ba4fc9a3f99e92784d5351d
MD5 8ae72e0b94e911d51c2f29402adebec2
BLAKE2b-256 3ade017f5dbbdfad652e9e9a197927e61a2e663418448587cb6fbb9a68c3acd8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kop_cli-0.1.0a4-py3-none-any.whl
  • Upload date:
  • Size: 109.2 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.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 387b0f35a5f3ea3f98e0bca97d499e2d1952eb30fac28243f05e3d5f7caf25e8
MD5 8e33ad38b9eb6f562305d7e4aaedd176
BLAKE2b-256 baddf36928b5c61f90e56aef09b70fdfe483b017ae709c60eda5ff2c0036f406

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