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

kubectl

$ kubectl Foundation High Risk
Kubernetes / CNCF · Cloud & Infra · Apache-2.0 · macos / linux / windows

kubectl controls Kubernetes clusters with exemplary agent ergonomics: -o json output, -o jsonpath=... and -o custom-columns=... projection, client/server --dry-run=server, live kubectl diff, and RBAC pre-checks via kubectl auth can-i.

FCRS-1.0 Score
88 /100
Good
High Confidence
Zero-Friction Install
brew install kubectl
CLI vs MCP Decision CLI Preferred vs MCP

kubectl has -o json, -o jsonpath, --dry-run=server, and kubectl diff baked in; LLMs know its exact grammar natively.

Agent-Readiness Checklist

Local Probe Evidence
✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
✓ Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md
Version
Client Version: v1.36.1
Startup
38 ms
Exit Codes (help / invalid)
0 / 1
NO_COLOR Clean / Non-TTY Safe
Yes / Safe
Captured --help excerpt
kubectl controls the Kubernetes cluster manager.

 Find more information at: https://kubernetes.io/docs/reference/kubectl/

Basic Commands (Beginner):
  create          Create a resource from a file or from stdin
  expose          Take a replication controller, service, deployment or pod and expose it as a new Kubernetes service
  run             Run a particular image on the cluster
  set             Set specific features on objects

Basic Commands (Intermediate):
  explain         Get documentation for a resource
  get             Display one or many resources
  edit            Edit a resource on the server
  delete          Delete resources by file names, stdin, resources and names, or by resources and label selector

Deploy Commands:
  rollout         Manage the rollout of a resource
  scale           Set a new size for a deployment, replica set, or replication controller
  autoscale       Auto-scale a deployment, replica set, stateful set, or replication controller

Cluster Management Commands:
  certificate     Modify certificate resources
  cluster-info    Display cluster information
  top             Display resource (CPU/memory) usage
  cordon          Mark node as unschedulable
  uncordon        Mark node as schedulable
  drain           Drain node in preparation for maintenance
  taint           Update the taints on one or more nodes

Troubleshooting and Debugging Commands:
  describe        Show details of a specific resource or group of resources
  logs            Print the logs for a container in a pod
  attach          Attach to a running container
  exec            Execute a command in a container
  port-forward    Forward one or more local ports to a pod
  proxy           Run a proxy to the Kubernetes API server
  cp              Copy files and directories to and from containers
  auth            Inspect authorization
  debug           Create debugging sessions for troubleshooting workloads and nodes
  events          List events

Advanced Commands:
  diff            Diff the live version against a would-be applied version
  apply           Apply a configuration to a resource by file name or stdin
  patch           Update fields of a resource
  replace         Replace a resource by file name or stdin
  wait            Wait for a specific condition on one or many resources
  kustomize       Build a kustomization target from a directory or URL

Settings Commands:
  label           Update the labels on a resource
  annotate        Update the 

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 19 / 25

Universal -o json, -o jsonpath=..., --field-selector, --dry-run=client|server, and kubectl explain introspection.

  • Supports -o json, -o jsonpath, --dry-run=server, and kubectl explain
Trust & Safety 21 / 25

kubectl diff, --dry-run=server, and kubectl auth can-i provide best-in-class mutation previews, though multi-cluster kubeconfig mistakes carry high impact.

  • Server-side --dry-run=server, kubectl diff, and RBAC auth can-i
Setup & Portability 15 / 15

Single static Go binary available via Homebrew, OS packages, and official binaries across macOS, Linux, and Windows.

  • Static Go binary on all major platforms
Utility & Efficiency 14 / 15

Server-side selectors and -o jsonpath keep cluster queries lean even on huge clusters.

  • Server-side --field-selector and -l label filtering
Maintenance & Lineage 10 / 10

CNCF graduated flagship (kubernetes/kubectl) maintained alongside every Kubernetes release.

  • Official CNCF kubernetes/kubectl under Apache-2.0
Docs & Verifiability 9 / 10

Complete online reference plus offline kubectl explain <resource> CRD/schema introspection.

  • Offline kubectl explain API schema docs

Security, Auth & Guardrails

Auth Modes
Config File Service Account OAuth Browser
Credential Storage

Reads cluster contexts, client certificates, and exec auth plugins from ~/.kube/config or KUBECONFIG.

Side Effects
Read-Only Local Write Remote Write Destructive
Cost & Quotas

CLI is free (Apache-2.0); scaling workloads affects underlying cloud cluster costs.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# kubectl Agent Rules
- ALWAYS check `kubectl config current-context` and pass `--context` + `-n <namespace>` explicitly.
- Run `kubectl diff -f` and `kubectl apply --dry-run=server` before mutating cluster resources.
- Never run `kubectl delete` or `kubectl drain` on production contexts without explicit user approval.

Agent-Ready Command Recipes

Safe Read-Only Queries

Verify current cluster context and RBAC permissions
kubectl config current-context && kubectl auth can-i --list -n default

Confirms target cluster context and effective RBAC permissions before acting.

Query pods with -o json and --field-selector
kubectl get pods -n default --field-selector=status.phase!=Running -o json

Finds non-running pods in structured JSON with server-side field filtering.

Controlled Writes & Previews

Server-side dry-run and diff before applying manifests
kubectl diff -f deploy.yaml && kubectl apply -f deploy.yaml --dry-run=server -o json

Validates admission webhooks, schema, and live cluster diff without mutating state.

Strengths for Agents

  • + Server-side --dry-run=server and kubectl diff validate against live admission controllers safely.
  • + kubectl explain lets agents inspect any built-in or CRD schema offline/live.
  • + Consistent -o json and -o jsonpath across all resource types.

Caveats & Pitfalls

  • ! Operating against the wrong ~/.kube/config context can affect production clusters if --context is omitted.
  • ! Large -o json responses include verbose managedFields unless stripped.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI