ahmedasmar/k8s-troubleshooter
Systematic Kubernetes troubleshooting and incident response. Use this skill whenever the user mentions Kubernetes, K8s, kubectl, pods, containers, or clusters. Triggers include diagnosing CrashLoopBackOff, ImagePullBackOff, OOMKilled, or Pending pods, responding to production incidents, troubleshooting node NotReady or DiskPressure, debugging service connectivity or networking, investigating PVC or storage failures, analyzing performance degradation, checking cluster health, troubleshooting Helm releases, and conducting post-incident reviews.
npx skills add https://github.com/ahmedasmar/devops-claude-skills --skill k8s-troubleshooter
Systematic approach to diagnosing and resolving Kubernetes issues in production environments.
Follow this systematic approach for any Kubernetes issue:
Run cluster health check:
# Check node status and health
kubectl get nodes
# Find non-running pods across all namespaces
kubectl get pods -A --field-selector status.phase!=Running
# Check node resource usage
kubectl top nodes
This provides an overview of:
Based on triage results, focus investigation:
For Namespace-Level Issues:
python3 scripts/check_namespace.py <namespace>
This provides comprehensive namespace health:
For Pod Issues:
# Get full pod details (status, events, conditions, resource config)
kubectl describe pod <pod-name> -n <namespace>
# Check current and previous container logs
kubectl logs <pod-name> -n <namespace>
kubectl logs <pod-name> -n <namespace> --previous
# Get events specific to the pod
kubectl get events -n <namespace> --field-selector involvedObject.name=<pod-name>
This reveals:
For additional investigations:
kubectl get events -n <namespace> --sort-by='.lastTimestamp'Consult references/common_issues.md for detailed information on:
Each issue includes:
Follow remediation steps from common_issues.md based on root cause identified.
Always:
After applying fix:
For production incidents, follow structured response in references/incident_response.md:
Severity Assessment:
Incident Phases:
Common Incident Scenarios:
See references/incident_response.md for detailed playbooks.
kubectl cluster-info
kubectl get nodes
kubectl get pods --all-namespaces | grep -v Running
kubectl get events --all-namespaces --sort-by='.lastTimestamp' | tail -20
kubectl describe pod <pod> -n <namespace>
kubectl logs <pod> -n <namespace>
kubectl logs <pod> -n <namespace> --previous
kubectl exec -it <pod> -n <namespace> -- /bin/sh
kubectl get pod <pod> -n <namespace> -o yaml
kubectl describe node <node>
kubectl top nodes
kubectl top pods --all-namespaces
ssh <node> "systemctl status kubelet"
ssh <node> "journalctl -u kubelet -n 100"
kubectl describe svc <service> -n <namespace>
kubectl get endpoints <service> -n <namespace>
kubectl get networkpolicies --all-namespaces
kubectl get pvc,pv --all-namespaces
kubectl describe pvc <pvc> -n <namespace>
kubectl get storageclass
kubectl describe resourcequota -n <namespace>
kubectl describe limitrange -n <namespace>
kubectl get rolebindings,clusterrolebindings -n <namespace>
Namespace-level health check and diagnostics:
Usage:
# Human-readable output
python3 scripts/check_namespace.py <namespace>
# JSON output for automation
python3 scripts/check_namespace.py <namespace> --json
# Include more events
python3 scripts/check_namespace.py <namespace> --events 20
Best used when troubleshooting issues in a specific namespace or assessing overall namespace health.
For cluster-wide health checks, use kubectl directly:
# Node health and status
kubectl get nodes
kubectl top nodes
# Find non-running pods across all namespaces
kubectl get pods -A --field-selector status.phase!=Running
# System pod health
kubectl get pods -n kube-system
For detailed pod investigation, use kubectl directly:
# Full pod details (status, events, conditions, resource config)
kubectl describe pod <pod-name> -n <namespace>
# Current and previous container logs
kubectl logs <pod-name> -n <namespace>
kubectl logs <pod-name> -n <namespace> --previous
# Events specific to the pod
kubectl get events -n <namespace> --field-selector involvedObject.name=<pod-name>
Comprehensive guide to common Kubernetes issues with:
Covers:
Read this when you identify a specific issue type but need detailed remediation steps.
Structured incident response framework including:
Read this when responding to production incidents or planning incident response procedures.
Comprehensive performance diagnosis and optimization guide covering:
Read this when:
Complete guide to Helm troubleshooting including:
Read this when:
Take ahmedasmar/k8s-troubleshooter from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.