k8s-incident-triage
Skill229 starsChanged 5 months agoApache-2.0View on GitHub
Read-only Kubernetes incident triage using kubectl. Accepts natural language or structured input. Produces root-cause hypotheses, evidence, and next-step commands.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- code-agentSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 11 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
NEVER use http_request or web_search to interact with Kubernetes.
- Distinctive: line 51
All cluster operations MUST go through kubectl via the cli_execute tool.
- Very specific: line 79
If namespace omitted, use $DEFAULT_NAMESPACE if set.
- Distinctive: line 80
If ambiguity exists, default to namespace-level triage.
- Distinctive: line 81
Never require the user to remember JSON fields.
- Very specific: line 107
If pod_name provided → pod-level triage.
- Distinctive: line 108
If workload fields provided → workload-level triage.
- Distinctive: line 122
If RBAC denies access:
- Distinctive: line 213
If restart loops and include_previous_logs=true:
- Distinctive: line 219
Prefer previous logs for CrashLoopBackOff.
- Distinctive: line 221
Never print Secret values.
- Distinctive: line 301
Avoid dumping full environment variables.
- Distinctive: line 317
Avoid excessive cluster load
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Kubernetes Incident Triage
Performs read-only triage of Kubernetes workloads and namespaces using kubectl.
Supports:
- Natural language input (human mode)
- Structured JSON input (automation mode)
This skill NEVER mutates cluster state.
Tool Usage
This skill uses cli_execute with kubectl commands exclusively.
NEVER use http_request or web_search to interact with Kubernetes.
All cluster operations MUST go through kubectl via the cli_execute tool.
Tool: k8s_triage
Diagnose unhealthy Kubernetes workloads, pods, or namespaces.
Input Modes
1) Human Mode (Natural Language)
Input is a plain string.
Examples:
triage payments-prodtriage deployment payments-api in payments-prodwhy are pods pending in checkout-prod?investigate crashloop in payments-prodtriage pod api-7c9f6d7f86-abcde in payments-prodcheck rollout of deployment payments-api in prod
Behavior:
- Parse namespace, workload, pod, or selector intent.
- If namespace omitted, use
$DEFAULT_NAMESPACEif set. - If ambiguity exists, default to namespace-level triage.
- Never require the user to remember JSON fields.
2) Automation Mode (Structured JSON)
Input JSON schema:
{ "namespace": "payments-prod", "workload_kind": "deployment", "workload_name": "payments-api", "pod_name": null, "label_selector": null, "include_logs": true, "logs_tail_lines": 200, "include_previous_logs": true, "events_limit": 50, "include_node_diagnostics": true, "include_metrics": false, "output_format": "markdown" }
Rules:
namespaceis required.- If
pod_nameprovided → pod-level triage. - If workload fields provided → workload-level triage.
- Else → namespace scan.
Triage Process
Step 0 — Preconditions
Verify cluster access:
kubectl version --client kubectl cluster-info
If RBAC denies access:
- Continue with allowed operations.
- Explicitly report denied commands in output.
Step 1 — Fast Health Snapshot
Namespace scope:
kubectl get pods -n <ns> -o wide
kubectl get deploy,sts,ds,job,cronjob -n <ns>
Workload scope:
kubectl get <kind> <name> -n <ns>
kubectl rollout status <kind>/<name> -n <ns> --timeout=10s
Select pods in states:
- CrashLoopBackOff
- ImagePullBackOff
- ErrImagePull
- Pending / Unschedulable
- Error
- NotReady
- OOMKilled
- High restart count
Limit deep triage to $TRIAGE_MAX_PODS (default 5).
Step 2 — Events Timeline
kubectl get events -n <ns> --sort-by=.lastTimestamp | tail -n <events_limit>
Look for:
- FailedScheduling
- FailedMount
- Unhealthy (probe failures)
- Back-off pulling image
- Evicted
- Node pressure signals
Step 3 — Describe Pods & Workloads
For each selected pod:
kubectl describe pod <pod> -n <ns>
Capture:
- Container state and reason
- Restart count
- Last termination reason
- Probe failures
- Volume mount issues
- Node assignment
- Taints / tolerations
- Affinity constraints
If workload-level triage:
kubectl describe <kind> <name> -n <ns>
Step 4 — Node Diagnostics (Optional)
kubectl get nodes -o wide
kubectl describe node <node>
Check for:
- NotReady
- MemoryPressure
- DiskPressure
- PIDPressure
- Evictions
Step 5 — Logs (Optional)
kubectl logs <pod> -n <ns> --all-containers --tail=<N>
If restart loops and include_previous_logs=true:
kubectl logs <pod> -n <ns> --previous --all-containers --tail=<N>
Rules:
- Prefer previous logs for CrashLoopBackOff.
- Redact obvious sensitive patterns.
- Never print Secret values.
Step 6 — Optional Metrics
If enabled:
kubectl top pods -n <ns>
kubectl top node
Gracefully skip if metrics-server is unavailable.
Detection Heuristics
Classify detected issues into:
- CrashLoop / Application Crash
- OOMKilled / Resource Limits
- Image Pull Failure
- Scheduling Constraint
- Probe Failure
- PVC / Volume Failure
- Node Pressure / Eviction
- Rollout Stuck
- Unknown / Escalation Needed
For each issue provide:
- Hypothesis
- Supporting evidence
- Confidence score (0.0–1.0)
- Recommended next commands
Output Structure
1) Incident Summary
- Namespace
- Scope (pod/workload/namespace)
- Affected resources count
- Timestamp
2) Top Findings
Concise bullet summary.
3) Likely Root Causes (Top 3)
For each:
- Description
- Evidence excerpt
- Confidence
- Recommended actions
4) Next Commands
Copy-paste kubectl commands.
5) Evidence Appendix
- Events (recent)
- Describe excerpts
- Log excerpts
Safety Constraints
This skill MUST:
- Perform read-only kubectl operations only.
- Never execute:
- apply
- patch
- delete
- exec
- port-forward
- scale
- rollout restart
- Never print Secret values.
- Avoid dumping full environment variables.
Autonomous Compatibility
This skill is designed to be invoked by:
- k8s_alert_handler (alert-triggered triage)
- k8s_patrol (scheduled patrol scans)
- Humans via natural language CLI
It must:
- Be idempotent
- Produce deterministic fingerprints
- Avoid excessive cluster load
- Limit deep triage scope
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.

