agentleFS
greedychipmunkgreedychipmunk/agent-skills/kubectl/SKILL.md

kubectl

Skill19 starsChanged 6 months agoMITView on GitHub

Manage Kubernetes resources, contexts, and workloads with kubectl. Use when tasks mention kubectl, Kubernetes resources, kubeconfig, kubectl apply, kubectl get pods, Kubernetes contexts, or KUBECONFIG.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to keep Kubernetes resource management deterministic and safe across clusters and namespaces.

    line 12
  2. Very specific:

    Always confirm active context (kubectl config current-context) before applying changes to prevent applying to the wrong cluster.

    line 55
  3. Very specific:

    Always specify namespace explicitly with -n <namespace> for production operations.

    line 56
  4. Very specific:

    Use --dry-run=client -o yaml to preview resources before applying.

    line 57
  5. Very specific:

    Use kubectl diff -f <file> to see what will change before applying.

    line 58
  6. Very specific:

    Never run kubectl delete namespace <name> without explicit user confirmation.

    line 60
  7. Very specific:

    Prefer kubectl rollout undo over direct manifest rewrites for reverting deployments.

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

kubectl

Use this skill to keep Kubernetes resource management deterministic and safe across clusters and namespaces.

Intent Router

RequestReferenceLoad When
Install, kubeconfig setup, contexts, env varsresources/install-and-setup.mdUser needs to install kubectl or configure KUBECONFIG/contexts
Core commands: get/describe/apply/delete/logs/execresources/command-cookbook.mdUser needs daily kubectl operations
Resources, labels, namespaces, explainresources/resource-management.mdUser asks about resource types, labels, selectors, or declarative workflows
Pod crashes, ImagePull errors, events, debugresources/troubleshooting.mdUser encounters CrashLoopBackOff, OOMKilled, or needs cluster diagnostics

Quick Start

# Verify connectivity
kubectl cluster-info
kubectl get nodes

# Confirm active context and namespace
kubectl config current-context
kubectl config view --minify

# List pods in all namespaces
kubectl get pods -A

# Apply a manifest
kubectl apply -f deployment.yaml --dry-run=client
kubectl apply -f deployment.yaml

Core Command Tracks

  • Read state: kubectl get/describe <resource> — inspect current cluster state
  • Apply changes: kubectl apply -f — declarative reconciliation
  • Logs: kubectl logs <pod> [-c <container>] [-f] [--previous]
  • Shell: kubectl exec -it <pod> -- bash
  • Port forward: kubectl port-forward <pod> 8080:80
  • Rollout: kubectl rollout status/history/undo deployment/<name>
  • Scale: kubectl scale deployment/<name> --replicas=3
  • Output formats: -o wide, -o json, -o yaml, -o jsonpath

Safety Guardrails

  • Always confirm active context (kubectl config current-context) before applying changes to prevent applying to the wrong cluster.
  • Always specify namespace explicitly with -n <namespace> for production operations; never rely on default namespace alone.
  • Use --dry-run=client -o yaml to preview resources before applying.
  • Use kubectl diff -f <file> to see what will change before applying.
  • Confirm before running kubectl delete — especially with label selectors (-l) which can match many resources.
  • Never run kubectl delete namespace <name> without explicit user confirmation; it deletes all resources in the namespace.
  • Prefer kubectl rollout undo over direct manifest rewrites for reverting deployments.
# Troubleshoot a crashing pod: check recent events then inspect previous container logs
kubectl get events --sort-by=.lastTimestamp -n my-namespace
kubectl logs my-pod --previous -n my-namespace

Workflow

  1. Confirm context: kubectl config current-context and kubectl config get-contexts.
  2. Inspect current state with kubectl get and kubectl describe before making changes.
  3. Preview changes with kubectl diff -f <file> or --dry-run=client.
  4. Apply changes with kubectl apply -f <file>.
  5. Monitor rollout with kubectl rollout status deployment/<name>.
  6. On failure, check events with kubectl get events --sort-by=.lastTimestamp.

Related Skills

  • helm — package manager for Kubernetes applications
  • docker — container image building for Kubernetes workloads

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.