/claude-kit:kubectl-operationsfrom Claude Kit SDLC
Provides safe kubectl command patterns for inspecting, debugging, and modifying Kubernetes workloads. Covers context/namespace safety, output formatting, rollouts, scaling, exec, logs, and RBAC checks.
Ships in Claude Kit SDLC. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
kubectl is the operational interface to the workloads the other skills define — the Deployments,
MODE-dispatched pods, Temporal-worker Deployments, CronJobs, and Helm-rendered resources. This skill
is the day-2 command surface: how to inspect, change, debug, roll out, and roll back, and how to do it
safely (the right context and namespace first, read before write, dry-run before apply).
Companion skills:
cron-and-scheduled-jobs(the CronJobs/Jobs you operate here),kubernetes-workload-hardening(the securityContext/RBAC you inspect withauth can-i/-o yaml),containerization-and-deployment(the images +MODEpods you're running),temporal-config-driven(the worker Deployments + schedule-registration Job), andobservability-and-logging(logs/events/topcomplement metrics/traces).
auth can-i) or impersonating (--as)The single most common kubectl accident is running the right command against the wrong cluster or namespace. Make the preamble a habit:
kubectl config current-context # WHICH cluster am I about to touch?
kubectl config get-contexts # list all; * marks current
kubectl config use-context <ctx> # switch cluster
kubectl config set-context --current --namespace=<ns> # pin a default namespace
kubectl -n <ns> get pods # or scope per-command with -n
get/describe/logs are safe; apply/edit/patch/scale
change state. Confirm the context line before any write.kubectl edit/patch on a
Helm-managed object is overwritten on the next deploy and causes drift. Change the source (values/
manifests) and redeploy. Use edit/patch only for break-glass, and reconcile after.--dry-run=server (the API validates it).kube-ps1) so prod is visually obvious.kubectl delete is disabled here. This kit ships a guard-kubectl-delete guardrail that blocks
kubectl delete from an agent session — a delete is far too easy to misfire against the wrong
namespace or cluster. To remove or replace a workload, change the Git/Helm source and let the pipeline
reconcile; to stop one now, kubectl scale --replicas=0; to undo a bad rollout, kubectl rollout undo.
Read-only checks like kubectl auth can-i delete … still work.| Task | Command(s) |
|---|---|
| List / inspect | get, describe, explain, api-resources |
| See full spec | get <res> <name> -o yaml |
| Create / change | apply -f, create, edit, patch, set, replace (delete is guarded — see Safety) |
| Preview a change | apply -f x.yaml --dry-run=server -o yaml, diff -f x.yaml |
| Logs | logs, logs -f, logs --previous, logs -l app=x --all-containers |
| Get a shell / run a command | exec -it <pod> -- sh, run, debug |
| Reach a pod/service locally | port-forward, proxy |
| Copy files | cp |
| Roll out / back | rollout status, rollout restart, rollout undo, rollout history |
| Scale | scale, autoscale |
| Events (why?) | events, get events --sort-by=.lastTimestamp, describe |
| Resource usage | top pod, top node (needs metrics-server) |
| Labels / annotations | label, annotate |
| Access checks | auth can-i, auth can-i --list, --as |
| Jobs / CronJobs | create job --from=cronjob/<name>, get/describe job, patch suspend |
| Node ops | cordon, drain, uncordon, taint |
| Wait for a condition | wait --for=condition=Ready pod -l app=x |
kubectl get pods # current namespace
kubectl get pods -A # all namespaces (--all-namespaces)
kubectl get pods -o wide # + node, IP
kubectl get deploy,svc,cm -l app=my-service # multiple kinds, label-filtered
kubectl get pod my-pod -o yaml # full live spec
kubectl describe pod my-pod # events + state + why (read the Events section)
kubectl explain deployment.spec.template.spec # schema/docs for any field
kubectl api-resources # every resource kind + shortname + apiGroup
kubectl get events --sort-by=.lastTimestamp # recent cluster events
kubectl get pods -A | grep -i crashloop # quick text filter (prefer -l / --field-selector / jsonpath when you can)
kubectl diff -f deploy.yaml # what WOULD change vs live
kubectl apply -f deploy.yaml --dry-run=server -o yaml # validate w/o applying
kubectl apply -f deploy.yaml # declarative create/update (preferred)
kubectl apply -k ./overlays/prod # kustomize
kubectl set image deploy/my-service app=registry.example.com/app:v2 # targeted image bump
kubectl scale deploy/my-service --replicas=3
kubectl patch deploy/my-service --type=merge -p '{"spec":{"replicas":3}}'
# To REMOVE a workload, change the Git/Helm source and reconcile, or stop it with `scale --replicas=0`.
# `kubectl delete` is blocked by the guard-kubectl-delete guardrail (see "Safety first: context and namespace").
Prefer apply (declarative) over imperative create/replace for anything you manage as files.
kubectl logs -f deploy/my-service # follow logs of a deployment's pod
kubectl logs my-pod -c sidecar --previous # previous (crashed) container's logs
kubectl logs -l app=my-service --all-containers --tail=200
kubectl exec -it my-pod -- sh # shell in (bash/sh)
kubectl debug -it my-pod --image=busybox --target=app # ephemeral debug container (distroless pods)
kubectl port-forward svc/my-service 8080:80 # reach the service at localhost:8080
kubectl cp my-pod:/var/log/app.log ./app.log # copy out
kubectl top pod -l app=my-service # live CPU/memory (metrics-server)
kubectl rollout status deploy/my-service # block until the rollout completes/fails
kubectl rollout restart deploy/my-service # re-roll pods (e.g. to pick up a changed Secret)
kubectl rollout history deploy/my-service # revisions
kubectl rollout undo deploy/my-service # roll back to the previous revision
kubectl rollout undo deploy/my-service --to-revision=3
kubectl autoscale deploy/my-service --min=2 --max=10 --cpu=70% # --cpu takes 70% or 500m; add --memory=70%
kubectl get cronjob # SCHEDULE, SUSPEND, LAST SCHEDULE
kubectl get jobs # COMPLETIONS, DURATION
kubectl create job my-job-manual --from=cronjob/my-cron # run a CronJob's job NOW (ad hoc)
kubectl patch cronjob/my-cron -p '{"spec":{"suspend":true}}' # pause a CronJob
kubectl logs job/my-job-manual # logs of the job's pod
kubectl logs -l job-name=my-job-manual --tail=-1 # all pods of the job
A cron that "didn't run": check
get cronjob(isSUSPENDtrue? what'sLAST SCHEDULE?), thendescribe cronjob/<name>(Events: "missed start"), then the Job/pod logs. Seecron-and-scheduled-jobsfor the scheduling model.
kubectl auth can-i create deployments -n my-namespace # yes/no for ME
kubectl auth can-i --list -n my-namespace # everything I can do here
kubectl auth can-i get secrets --as=system:serviceaccount:my-namespace:my-sa # check a SA
kubectl get nodes -o wide
kubectl cordon <node> # mark unschedulable
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data # evict pods for maintenance
kubectl uncordon <node> # schedulable again
kubectl top node # node CPU/memory
# 0. Confirm WHERE you are.
kubectl config current-context && kubectl config view --minify -o jsonpath='{..namespace}{"\n"}'
# 1. What's broken?
kubectl get pods -l app=my-service # STATUS: CrashLoopBackOff / ImagePullBackOff / Pending
kubectl rollout status deploy/my-service --timeout=60s # fails fast if the roll is stuck
# 2. Why? Events first, then logs.
kubectl describe pod -l app=my-service # Events at the bottom say the real reason
kubectl logs -l app=my-service --previous --tail=100 # last words of the crashed container
# 3. Mitigate (roll back is usually fastest).
kubectl rollout undo deploy/my-service
kubectl rollout status deploy/my-service
# 4. If config-related: confirm the env/secret the pod actually got.
kubectl get pod <pod> -o jsonpath='{.spec.containers[0].env[*].name}{"\n"}'
current-context before apply/scale/rollout.kubectl edit/patch on a Helm/GitOps-managed resource — it's silently reverted on next deploy
and creates drift. Change the source and redeploy; reserve live edits for break-glass.kubectl delete — it's intentionally excluded from this skill and blocked by the
guard-kubectl-delete guardrail (deletes from an agent session misfire too easily). To stop a
workload, scale --replicas=0; to roll back, rollout undo; to remove a resource, delete it from the
Git/Helm source and let the pipeline reconcile.get when you needed describe — get shows status; the reason (failed mounts, scheduling,
probe failures, image pull) is in describe Events and kubectl events.--previous on a crash-looping pod — the live container may be too young to have logs;
the crash is in the previous instance.-o yaml / get secret dumped to a shared terminal — Secret values are base64 (not encrypted);
redacting matters. Don't paste them into tickets/logs.kubectl apply of a file that was previously created imperatively — ownership/last-applied
mismatch. Pick declarative (apply) and stay there.--force --grace-period=0 as a habit — force-deleting pods can leave StatefulSet/PV state
inconsistent. Use it only when you understand the consequence.--dry-run/diff before applying to prod — preview server-side first.apply it.-o wide/yaml/json/name/jsonpath/custom-columns/go-template, --sort-by, label selectors (-l), field
selectors (--field-selector), --watch, and ready-to-use JSONPath recipes.auth can-i, impersonation, and kubectx/kubens/krew.README.md (opens in a new tab)references/command-reference.md (opens in a new tab)references/context-namespace-rbac.md (opens in a new tab)references/debugging-playbooks.md (opens in a new tab)references/output-formats-and-selectors.md (opens in a new tab)references/repo-evidence.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ajyadav013/claude-kit --plugin claude-kit127 skills in this plugin
/accessibility-reviewUI accessibility (WCAG) review — keyboard operability, focus, ARIA semantics, color contrast, touch targets. Returns prioritized fixes. Distinct from performance/visual review./alembic-migrationsAlembic migration setup and patterns for async SQLAlchemy — async engine + run_sync in env.py, autogenerate, RLS/multi-tenant migrations. Use for alembic init, writing migrations, or debugging migration errors./anthropic-vertex-integrationClaude on Vertex AI via the AnthropicVertex SDK — lazy ADC client init, env-based project/region resolution, async helpers, backoff retry. Use when calling Claude via GCP Vertex AI (not direct Anthropic API).Other plugins' skills for the same job