k8s-debug
Skill0 starsChanged 8 months agoMITView on GitHub
Investigate a failing Kubernetes pod or workload by pulling events, logs, and describe output. Use when the user reports a CrashLoopBackOff, ImagePullBackOff, OOMKilled, Pending pod, Init container failure, or any pod that is not Running and Ready.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- Thakurvaibhav/platform-agent-harnesstheir own version, first seen Jul 4, 2026
- agenticdevops/devops-execution-enginetheir own version, first seen Jan 26, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Thakurvaibhav/platform-agent-harness★ 2same name
- agenticdevops/devops-execution-engine★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- composeSkill
- docker-debugSkill
- dockerfileSkill
- helm-reviewSkill
- manifestSkill
- rbac-reviewSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
If the user does not give a pod name, ask for it.
- Distinctive: line 24
Run the commands in this order.
- Very specific: line 45
If describe shows a Restart Count greater than zero or a Last State, also run:
- Distinctive: line 65
If the issue is a Deployment that is stuck mid-rollout:
- Distinctive: line 76
When the pod is Running and Ready but requests from other pods or from an Ingress fail, check that the Service has endpoints:
- Very specific: line 83
If the endpoints list is empty, the Service spec.selector does not match any pod labels.
- Distinctive: line 87
If DNS resolves but connections time out or are refused, check for a NetworkPolicy that blocks the traffic:
- Distinctive: line 116
If the diagnosis needs more data, say which command to run next and why.
- Very specific: line 149
Do not run kubectl delete, kubectl edit, kubectl patch, or kubectl apply without asking the user first.
- Distinctive: line 150
Do not guess. If logs and events are empty, explain that and suggest how to enable more verbose logging.
≈ “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.
Files
Debug a failing pod
Explain why a pod is not Running and Ready, and suggest a concrete fix.
Inputs
$ARGUMENTS should be the pod name followed by an optional namespace. Examples:
api-7c4d8b9f5d-xzq4pmy-pod defaultworker-0 production
If the user does not give a pod name, ask for it. If no namespace is given, default to default.
Workflow
Run the commands in this order. Stop early if you find a clear root cause.
Step 1: status and events
kubectl get pod <pod> -n <ns> -o wide
kubectl describe pod <pod> -n <ns>Focus on:
StatusandReasonat the top of describe output.Conditionsblock (PodScheduled, Initialized, ContainersReady, Ready).Eventssection at the bottom. Recent events are almost always where the answer is.Containerssection, specificallyStateandLast Statewith theirReasonandExit Code.
Step 2: logs
kubectl logs <pod> -n <ns> --tail=200 --timestampsIf describe shows a Restart Count greater than zero or a Last State, also run:
kubectl logs <pod> -n <ns> --previous --tail=200 --timestampsThe --previous flag shows logs from the last crashed instance, which is usually what you need in a CrashLoopBackOff. Do not treat previous terminated container not found as a second failure: a StartError can fail before the first process ever starts, leaving no log stream. In that case, use the State.Message and the pod Events from describe as the evidence.
For pods with multiple containers, add -c <container-name>.
Step 3: cluster-level events (if pod events are not enough)
kubectl get events -n <ns> --sort-by=.lastTimestamp | tail -30On Windows shells without tail, run the same kubectl get events ... command without the pipe and summarize only the latest 30 rows from the returned output.
Step 4: rollout status (for Deployment and StatefulSet)
If the issue is a Deployment that is stuck mid-rollout:
kubectl rollout status deployment/<name> -n <ns> --timeout=60s
kubectl rollout history deployment/<name> -n <ns>This shows whether new pods are coming up and what the previous revisions looked like.
Step 5: Service endpoints (pod is Ready but callers cannot reach it)
When the pod is Running and Ready but requests from other pods or from an Ingress fail, check that the Service has endpoints:
kubectl get endpoints <service> -n <ns>
kubectl describe service <service> -n <ns>If the endpoints list is empty, the Service spec.selector does not match any pod labels. Compare them side by side.
Step 6: NetworkPolicy (network calls blocked)
If DNS resolves but connections time out or are refused, check for a NetworkPolicy that blocks the traffic:
kubectl get networkpolicy -n <ns>
kubectl describe networkpolicy -n <ns>A namespace with a default-deny policy needs an explicit allow rule for the traffic you expect.
Common failures and fixes
- ImagePullBackOff or ErrImagePull: image name or tag wrong, or missing registry credentials. Check the image reference and any
imagePullSecrets. - CrashLoopBackOff: the container keeps exiting on startup. Read
--previouslogs for the real error. Usually a missing env var, failed migration, or bad config. - StartError or exit code 128: the runtime could not start the configured executable, often because
commandpoints to a path that does not exist in the image. Read theState.Messageand Events, then correctcommandorargs. Do not usekubectl exec; the container never started. - OOMKilled (Exit code 137): the container ran out of memory. Raise
resources.limits.memoryor fix a memory leak. - Init:Error: an init container failed. Use
kubectl logs <pod> -c <init-container-name>to read its output. - Pending with "0/N nodes are available": the scheduler could not place the pod. Common causes: insufficient CPU or memory on any node, node selector or affinity rules, taints without tolerations, PVC not bound.
- Pending with volume attach error: a PersistentVolumeClaim is stuck. Check
kubectl get pvc -n <ns>and the storage class. - Liveness probe failing: the app is reachable but the probe config is wrong. Check the probe path, port, and initial delay.
- Readiness probe failing: the pod starts but is not Ready. The app often takes longer to start than the probe allows. Raise
initialDelaySecondsor fix the readiness endpoint. - Deployment stuck mid-rollout: new ReplicaSet pods fail readiness and the old ReplicaSet is still serving. Use
kubectl rollout statusand read the new pod's logs. Considerkubectl rollout undoafter the user approves. - Service has no endpoints:
spec.selectoron the Service does not match the pod labels. Fix one or the other so they agree. - NetworkPolicy blocks traffic: a deny-by-default policy is in force without an allow rule for the traffic. Add a policy that allows ingress from the expected source pods or namespaces.
Output
- State the root cause in one short sentence.
- Quote the 3 to 10 lines of output that support it.
- Give a concrete fix. If it needs a manifest change, show the before and after YAML block.
- If the diagnosis needs more data, say which command to run next and why.
Example diagnosis
Root cause: pod api-7c4d8b9f5d-xzq4p is in CrashLoopBackOff because it cannot reach Postgres at startup. The DATABASE_URL env var points to localhost:5432 instead of the in-cluster service.
Evidence:
$ kubectl logs api-7c4d8b9f5d-xzq4p -n default --previous --tail 5
2026-04-17T09:21:05Z error: connect ECONNREFUSED 127.0.0.1:5432
2026-04-17T09:21:05Z error: DatabaseConnectionError at startup
Exit code: 1Fix in the Deployment:
env:
- name: DATABASE_URL
value: postgres://app:app@postgres.default.svc.cluster.local:5432/app # was: postgres://app:app@localhost:5432/appNext step:
kubectl rollout restart deployment/api -n default
kubectl rollout status deployment/api -n defaultReference
If you encounter a pod status or event you do not immediately recognise, read reference/pod-error-patterns.md from the plugin root. It documents 10+ common patterns (CrashLoopBackOff, ImagePullBackOff, OOMKilled, Pending, Evicted, etc.) with the exact kubectl output, root causes, and fix commands. Do not read by default; only when a pattern is unfamiliar.
Do not
- Do not run
kubectl delete,kubectl edit,kubectl patch, orkubectl applywithout asking the user first. - Do not guess. If logs and events are empty, explain that and suggest how to enable more verbose logging.
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
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.

