kcli is the Kubilitics terminal core: kubectl-parity workflows with guardrails, context ergonomics, observability shortcuts, incident mode, and optional AI.
Requirements: kcli requires kubectl on your PATH for all standard Kubernetes verbs (get, apply, delete, logs, exec, etc.). kcli invokes kubectl for these commands. client-go is used only for context/namespace listing and auth checks.
Scale limits: TUI is tested for clusters with up to ~3k pods per view; for larger clusters use CLI. Completion may be slower on cold cache or CRD-heavy clusters (default timeout 250ms). See PRD §5.4 for details.
cd kcli
go build -o bin/kcli ./cmd/kclikcli builds for Windows (kcli-windows-amd64.exe). Full color and TUI support requires Windows Terminal. In cmd.exe and older PowerShell, ANSI colors are disabled automatically — output is plain text with no \x1b[32m-style escape sequences. Set KCLI_NO_COLOR=1 or NO_COLOR=1 to disable colors on any platform.
kcli completion bash > /etc/bash_completion.d/kcli
kcli completion zsh > "${fpath[1]}/_kcli"kcli get pods -A
kcli get pods -A --all-contexts
kcli get deploy -A --all-contexts --context-group prod
kcli search payments
kcli search api --context-group prod --kinds deployments,services,ingresses
kcli ctx
kcli ctx prod-cluster
kcli ctx group set prod prod-us-east prod-us-west
kcli ctx group prod
kcli ctx group export groups.json
kcli ctx group import groups.json --merge
kcli ns kube-system
kcli restarts
kcli events --recent 30m --output json
kcli incident
kcli incident --recent 2h --restarts-threshold 5 --output json
kcli incident export --since 1h --output ./incident-bundle
kcli incident export --since 30m --output replay.tar.gz --with-logs
kcli config view
kcli config set tui.refresh_interval 3s
kcli config get tui.refresh_interval
kcli kubeconfig get-contexts
kcli kubeconfig use-context prod
kcli exec -it pod/my-pod -- /bin/sh
kcli logs app=demo-app -n blue-green-demo --tail=50 --grep='error' --save=logs.txt
kcli logs deployment/my-app -n prod -f --timestamps
kcli logs pod/my-pod --ai-summarize
kcli logs app=my-api -n prod --ai-errors
kcli logs pod/my-pod --ai-explainMutating verbs prompt for confirmation by default. Use --force to bypass prompt in automated workflows.
kcli delete pod my-pod
kcli --force delete pod my-podSet KCLI_AI_PROVIDER and provider-specific credentials to enable AI commands. When enabled, resource names, context/namespace, event text, and log excerpts may be sent to the provider; secrets are redacted. For high-security environments, disable AI or use a self-hosted provider (e.g. Ollama).
Supported providers:
openai:KCLI_AI_PROVIDER=openai,KCLI_OPENAI_API_KEY(orKCLI_AI_API_KEY), optionalKCLI_AI_MODEL, optionalKCLI_AI_ENDPOINTanthropic:KCLI_AI_PROVIDER=anthropic,KCLI_ANTHROPIC_API_KEY(orKCLI_AI_API_KEY), optionalKCLI_AI_MODELazure-openai:KCLI_AI_PROVIDER=azure-openai,KCLI_AZURE_OPENAI_API_KEY,KCLI_AZURE_OPENAI_ENDPOINT,KCLI_AZURE_OPENAI_DEPLOYMENT, optionalKCLI_AZURE_OPENAI_API_VERSIONollama:KCLI_AI_PROVIDER=ollama, optionalKCLI_OLLAMA_ENDPOINT, optionalKCLI_AI_MODELcustom:KCLI_AI_PROVIDER=custom,KCLI_AI_ENDPOINT, optionalKCLI_AI_API_KEY
export KCLI_AI_PROVIDER=openai
export KCLI_OPENAI_API_KEY=sk-...
kcli ai explain deployment/my-app
kcli why pod/my-pod
kcli summarize events
kcli suggest fix deployment/my-app
kcli ai config --provider=openai --model=gpt-4o-mini --enable
kcli ai status
kcli ai usage
kcli ai costkcli ui launches the built-in Bubble Tea interface.
Keybindings:
/filter current resource list:<type>switch resources (:pods,:deploy,:svc,:nodes,:events,:ns,:ing,:cm,:secrets,:pvc,:jobs,:cronjobs)Ctrl+Xor:xrayopen relationship graph for selected resourceSpacemulti-select rowsCtrl+Bbulk actions (deleteorscale=<n>, with explicityesconfirmation)Ctrl+Ssave current table snapshotCtrl+Wtoggle wide modeCtrl+Tcycle themesCtrl+Atoggle AI on/off in TUIllogsddescribeyyamlAAI analyze (when enabled)- In detail mode:
4opens AI Analysis tab rrefreshqquit
Plugins live in ~/.kcli/plugins/ and use executable name prefix kcli-.
Each plugin must include a manifest (plugin.yaml) in the same directory.
kcli plugin list
kcli plugin search demo
kcli plugin marketplace
kcli plugin install cert-manager
kcli plugin info mytool
kcli plugin install ./my-local-plugin
kcli plugin install github.com/org/kcli-mytool
kcli plugin update mytool
kcli plugin update --all
kcli plugin remove mytool
kcli plugin inspect mytool
kcli plugin allow mytool
kcli plugin revoke mytool
kcli plugin run mytool --flag valueExample manifest:
name: mytool
version: 1.0.0
description: Example plugin
permissions:
- read:pods
- write:deployments
commands:
- mtYou can also run plugins directly as first-class commands:
kcli mytool --flag value
kcli mt --flag valuePlugin security: Plugins run with your user privileges and are not sandboxed (no process isolation, no network restriction). Install only plugins from trusted sources. By default, only executables under ~/.kcli/plugins/ are allowed; binaries must not be symlinks and must not be group/world-writable. To allow plugins from PATH, set KCLI_PLUGIN_ALLOW_PATH=1 (use only in controlled environments).
Official plugins in this repo:
./scripts/install-official-plugins.sh
./scripts/test-official-plugins.shContext history and favorites are persisted in ~/.kcli/state.json.
Configuration is stored in ~/.kcli/config.yaml.
Run the reproducible performance gate for TASK-KCLI-018:
cd kcli
./scripts/perf-check.shThis validates P95 startup/get/ctx latency and peak memory targets.
Run the alpha smoke suite:
cd kcli
./scripts/alpha-smoke.shThis exercises core commands, completion generation, cluster checks (when context is present), and performance gates.
Run the enterprise release gate before shipping:
cd kcli
./scripts/release-gate.shThis executes full tests, alpha smoke checks, and performance gates.