
K8s Incident
- 9 installs
- 941 repo stars
- Updated April 8, 2026
- rohitg00/kubectl-mcp-server
Helps with ai & agent building tasks during AI-assisted development.
About
k8s-incident is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- k8s-incident
- AI & Agent Building
- AI-coding skill
K8s Incident by the numbers
- 9 all-time installs (skills.sh)
- Ranked #12,152 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/rohitg00/kubectl-mcp-server --skill k8s-incidentAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 9 |
|---|---|
| repo stars | ★ 941 |
| Last updated | April 8, 2026 |
| Repository | rohitg00/kubectl-mcp-server ↗ |
What it does
Helps with ai & agent building tasks during AI-assisted development.
Files
Kubernetes Incident Response
Runbooks and diagnostic workflows for common Kubernetes incidents.
When to Apply
Use this skill when:
- User mentions: "incident", "outage", "emergency", "down", "not working"
- Operations: emergency response, production issues, service degradation
- Keywords: "urgent", "broken", "fix", "restore", "recover"
Priority Rules
| Priority | Rule | Impact | Tools |
|---|---|---|---|
| 1 | Check control plane first | CRITICAL | get_pods(namespace="kube-system") |
| 2 | Assess node health | CRITICAL | get_nodes |
| 3 | Gather events before changes | HIGH | get_events |
| 4 | Document timeline | HIGH | Manual notes |
| 5 | Rollback if safe | MEDIUM | rollback_deployment |
Quick Reference
| Incident | First Tool | Next Steps |
|---|---|---|
| Pod failure | get_pod_logs(previous=True) | describe_pod, get_events |
| Node down | describe_node | Check kubelet logs |
| Service unreachable | get_endpoints | get_network_policies |
| Control plane | get_pods(namespace="kube-system") | Check API server logs |
Incident Triage
Quick Health Check
get_nodes()
get_pods(namespace="kube-system")
get_events(namespace)Severity Assessment
| Indicator | Severity | Action |
|---|---|---|
| Multiple nodes NotReady | Critical | Escalate immediately |
| kube-system pods failing | Critical | Control plane issue |
| Single pod CrashLoop | Medium | Debug pod |
| High latency | Medium | Check resources |
Runbook: Pod Failures
CrashLoopBackOff
get_pod_logs(name, namespace, previous=True)
describe_pod(name, namespace)
get_events(namespace, field_selector="involvedObject.name=<pod>")
get_pod_metrics(name, namespace)Common Causes:
- OOMKilled → Increase memory limits
- Exit code 1 → Application error in logs
- Exit code 137 → Killed by OOM or SIGKILL
- Exit code 143 → Graceful SIGTERM
ImagePullBackOff
describe_pod(name, namespace)
get_secrets(namespace)Pending Pod
describe_pod(name, namespace)
get_nodes()
get_events(namespace)Runbook: Node Issues
Node NotReady
describe_node(name)
get_events(namespace="", field_selector="involvedObject.name=<node>")
node_logs_tool(name, "kubelet")Node DiskPressure
describe_node(name)
get_pods(field_selector="spec.nodeName=<node>")Runbook: Network Issues
Service Not Accessible
get_services(namespace)
get_endpoints(namespace)
get_pods(namespace, label_selector="<service-selector>")
get_network_policies(namespace)DNS Resolution Failures
get_pods(namespace="kube-system", label_selector="k8s-app=kube-dns")
get_pod_logs("coredns-xxx", "kube-system")With Cilium
cilium_status_tool()
cilium_endpoints_list_tool(namespace)
hubble_flows_query_tool(namespace)With Istio
istio_analyze_tool(namespace)
istio_proxy_status_tool()Runbook: Storage Issues
PVC Pending
describe_pvc(name, namespace)
get_storage_classes()
get_events(namespace)Pod Stuck in ContainerCreating
describe_pod(name, namespace)
get_pvc(namespace)
get_events(namespace)Runbook: Control Plane Issues
API Server Unavailable
get_pods(namespace="kube-system", label_selector="component=kube-apiserver")
get_events(namespace="kube-system")etcd Issues
get_pods(namespace="kube-system", label_selector="component=etcd")
get_pod_logs("etcd-xxx", "kube-system")Emergency Actions
Force Delete Pod
delete_pod(name, namespace, grace_period=0, force=True)Rollback Deployment
rollback_deployment(name, namespace, revision=0)Helm Rollback
rollback_helm_release(name, namespace, revision=1)Diagnostic Collection Script
For comprehensive incident diagnostics, see scripts/collect-diagnostics.py.
Multi-Cluster Incident Response
Check all clusters:
for context in ["prod-1", "prod-2", "staging"]:
get_nodes(context=context)
get_pods(namespace="kube-system", context=context)
get_events(namespace="kube-system", context=context)Post-Incident
Document Timeline
1. When did the incident start? 2. What was the impact? 3. What was the root cause? 4. What fixed it?
Prevent Recurrence
- Add monitoring/alerting
- Improve resource limits
- Add readiness probes
- Document runbook
Related Skills
- k8s-troubleshoot - Detailed debugging
- k8s-security - Security incidents
#!/usr/bin/env python3
"""
Incident Diagnostics Collection Script
Collects comprehensive diagnostics for incident response.
Usage within Claude Code:
This script is called by the k8s-incident skill to collect
all relevant information during an incident.
"""
import json
import sys
from datetime import datetime
from typing import Any
def collect_diagnostics(
namespace: str = "",
context: str = "",
include_logs: bool = True,
since_minutes: int = 30
) -> dict[str, Any]:
"""
Collect comprehensive incident diagnostics.
Args:
namespace: Focus namespace (empty for cluster-wide)
context: Optional kubeconfig context
include_logs: Include pod logs
since_minutes: Time window for logs/events
Returns:
Dictionary with diagnostic collection plan
"""
diagnostics = {
"timestamp": datetime.utcnow().isoformat(),
"namespace": namespace or "all",
"context": context or "current",
"since_minutes": since_minutes,
"collection_plan": []
}
# Cluster health
diagnostics["collection_plan"].extend([
{
"category": "cluster_health",
"priority": 1,
"checks": [
{
"name": "nodes",
"tool": "get_nodes",
"params": {"context": context},
"description": "List all nodes and their status"
},
{
"name": "system_pods",
"tool": "get_pods",
"params": {"namespace": "kube-system", "context": context},
"description": "Check control plane pods"
}
]
}
])
# Namespace-specific if provided
if namespace:
diagnostics["collection_plan"].extend([
{
"category": "namespace_resources",
"priority": 2,
"checks": [
{
"name": "pods",
"tool": "get_pods",
"params": {"namespace": namespace, "context": context},
"description": "List all pods"
},
{
"name": "deployments",
"tool": "get_deployments",
"params": {"namespace": namespace, "context": context},
"description": "List deployments"
},
{
"name": "services",
"tool": "get_services",
"params": {"namespace": namespace, "context": context},
"description": "List services"
},
{
"name": "endpoints",
"tool": "get_endpoints",
"params": {"namespace": namespace, "context": context},
"description": "Check service backends"
},
{
"name": "events",
"tool": "get_events",
"params": {"namespace": namespace, "context": context},
"description": "Recent events"
}
]
}
])
if include_logs:
diagnostics["collection_plan"].append({
"category": "logs",
"priority": 3,
"note": "Collect logs from failing pods",
"checks": [
{
"name": "pod_logs",
"tool": "get_pod_logs",
"params": {
"namespace": namespace,
"tail_lines": 100,
"previous": True,
"context": context
},
"description": "Get logs from each failing pod"
}
]
})
# Network diagnostics
diagnostics["collection_plan"].append({
"category": "networking",
"priority": 4,
"checks": [
{
"name": "network_policies",
"tool": "get_network_policies",
"params": {"namespace": namespace, "context": context},
"description": "Check network policies"
},
{
"name": "ingresses",
"tool": "get_ingresses",
"params": {"namespace": namespace, "context": context},
"description": "Check ingress configuration"
}
]
})
# Storage diagnostics
diagnostics["collection_plan"].append({
"category": "storage",
"priority": 5,
"checks": [
{
"name": "pvcs",
"tool": "get_pvc",
"params": {"namespace": namespace, "context": context},
"description": "Check PVC status"
}
]
})
# Resource usage
diagnostics["collection_plan"].append({
"category": "resources",
"priority": 6,
"checks": [
{
"name": "resource_usage",
"tool": "get_resource_usage",
"params": {"namespace": namespace, "context": context},
"description": "Check resource consumption"
}
]
})
return diagnostics
def triage_findings(findings: dict[str, Any]) -> dict[str, Any]:
"""
Triage collected findings by severity.
Args:
findings: Collected diagnostic data
Returns:
Triaged findings with severity
"""
triage = {
"critical": [],
"warning": [],
"info": [],
"summary": ""
}
# Critical: Nodes not ready
nodes = findings.get("nodes", [])
not_ready = [n for n in nodes if n.get("status") != "Ready"]
if not_ready:
triage["critical"].append({
"type": "nodes_not_ready",
"count": len(not_ready),
"nodes": not_ready,
"action": "Investigate node health immediately"
})
# Critical: System pods failing
system_pods = findings.get("system_pods", [])
failing_system = [p for p in system_pods if p.get("status") not in ["Running", "Completed"]]
if failing_system:
triage["critical"].append({
"type": "system_pods_failing",
"count": len(failing_system),
"pods": failing_system,
"action": "Check control plane components"
})
# Warning: Application pods failing
pods = findings.get("pods", [])
failing_pods = [p for p in pods if p.get("status") not in ["Running", "Completed"]]
if failing_pods:
triage["warning"].append({
"type": "pods_failing",
"count": len(failing_pods),
"pods": failing_pods,
"action": "Check pod logs and events"
})
# Warning: Empty endpoints
endpoints = findings.get("endpoints", [])
empty_endpoints = [e for e in endpoints if not e.get("addresses")]
if empty_endpoints:
triage["warning"].append({
"type": "empty_endpoints",
"services": empty_endpoints,
"action": "Check pod selectors and readiness"
})
# Generate summary
critical_count = len(triage["critical"])
warning_count = len(triage["warning"])
if critical_count > 0:
triage["summary"] = f"CRITICAL: {critical_count} critical issues require immediate attention"
elif warning_count > 0:
triage["summary"] = f"WARNING: {warning_count} issues detected"
else:
triage["summary"] = "No significant issues detected"
return triage
def generate_incident_report(
diagnostics: dict[str, Any],
triage: dict[str, Any]
) -> str:
"""
Generate incident report.
Args:
diagnostics: Collected diagnostics
triage: Triaged findings
Returns:
Formatted incident report
"""
report = ["# Kubernetes Incident Diagnostic Report\n"]
report.append(f"Timestamp: {diagnostics['timestamp']}")
report.append(f"Context: {diagnostics['context']}")
report.append(f"Namespace: {diagnostics['namespace']}\n")
report.append(f"## Summary\n{triage['summary']}\n")
if triage["critical"]:
report.append("## Critical Issues\n")
for issue in triage["critical"]:
report.append(f"### {issue['type']}")
report.append(f"- Count: {issue.get('count', 'N/A')}")
report.append(f"- Action: {issue['action']}\n")
if triage["warning"]:
report.append("## Warnings\n")
for issue in triage["warning"]:
report.append(f"### {issue['type']}")
report.append(f"- Action: {issue['action']}\n")
report.append("## Collection Plan\n")
report.append("Execute the following MCP tools to gather data:\n")
for category in sorted(diagnostics["collection_plan"], key=lambda x: x["priority"]):
report.append(f"### {category['category'].replace('_', ' ').title()}")
for check in category["checks"]:
report.append(f"- `{check['tool']}`: {check['description']}")
report.append("")
return "\n".join(report)
if __name__ == "__main__":
namespace = sys.argv[1] if len(sys.argv) > 1 else ""
context = sys.argv[2] if len(sys.argv) > 2 else ""
result = collect_diagnostics(namespace, context)
print(json.dumps(result, indent=2))
Related skills
AI & Agent Buildingagents