Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

kubectx

$ kubectx Community Med Risk
Ahmet Alp Balkan · Cloud & Infra · Apache-2.0 · macos / linux / windows

kubectx (paired with kubens) switches the active cluster context or namespace in ~/.kube/config in one short command (kubectx <ctx>, kubectx -). For multi-agent or parallel shells, prefer passing kubectl --context <ctx> instead of mutating shared global kubeconfig state.

FCRS-1.0 Score
79 /100
Good
Medium Confidence
Zero-Friction Install
brew install kubectx
CLI vs MCP Decision CLI Only

kubectx edits the local ~/.kube/config file; context switching is purely local workstation state.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 17 / 25

Deterministic line-based output (kubectx -c, KUBECTX_IGNORE_FZF=1), though it has no JSON output and bare kubectx opens interactive fzf if fzf is installed.

  • Bare kubectx invokes fzf interactively unless KUBECTX_IGNORE_FZF=1 is set
  • Plain newline-delimited output; no --json flag
Trust & Safety 20 / 25

Only modifies local ~/.kube/config context/namespace pointers, though silently switching global current-context can cause parallel shells to target the wrong cluster.

  • Mutates global ~/.kube/config state across all shells sharing KUBECONFIG
Setup & Portability 14 / 15

Available as Go binaries or shell scripts via Homebrew, Krew, and GitHub releases across macOS, Linux, and Windows.

  • Available via brew install kubectx and kubectl krew
Utility & Efficiency 12 / 15

Convenient shorthand for human operators, though agents are generally safer using kubectl --context per command.

  • Quick -c inspection and - context toggling
Maintenance & Lineage 8 / 10

Well-known open-source tool (ahmetb/kubectx) under Apache-2.0.

  • Apache-2.0 ahmetb/kubectx repository
Docs & Verifiability 8 / 10

Concise README documenting flags (-c, -d, -) and KUBECTX_IGNORE_FZF.

  • Clear README and --help output

Security, Auth & Guardrails

Auth Modes
Config File
Credential Storage

Reads and updates current-context directly in ~/.kube/config (or $KUBECONFIG).

Side Effects
Read-Only Local Write
Cost & Quotas

Apache-2.0 open-source CLI; free to use.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# kubectx Agent Rules
- Always set `KUBECTX_IGNORE_FZF=1` when listing contexts.
- Prefer `kubectl --context <ctx> -n <ns>` over running `kubectx <ctx>` so you do not silently alter the user's or parallel agents' global kubeconfig context.

Agent-Ready Command Recipes

Safe Read-Only Queries

List available kubeconfig contexts without fzf
KUBECTX_IGNORE_FZF=1 kubectx

Lists all contexts one per line without launching an interactive fzf picker.

Print the currently active context
kubectx -c

Outputs only the current kubeconfig context name.

Controlled Writes & Previews

Switch kubeconfig context explicitly
kubectx staging-cluster

Updates current-context in ~/.kube/config to staging-cluster.

Strengths for Agents

  • + kubectx -c and KUBECTX_IGNORE_FZF=1 kubectx cleanly inspect kubeconfig contexts.
  • + Lightweight single-purpose tool with zero cluster API calls.
  • + Cross-platform Go binary implementation alongside shell scripts.

Caveats & Pitfalls

  • ! If fzf is on PATH, running bare kubectx without KUBECTX_IGNORE_FZF=1 enters an interactive picker.
  • ! Mutating global ~/.kube/config current-context can surprise concurrent terminals or agents.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI