Systematically debug Kubernetes clusters with a structured four-phase methodology covering CrashLoopBackOff, ImagePullBackOff, OOMKilled, pending pods, service connectivity, PVC binding, and RBAC errors using kubectl commands and ephemeral debug containers.
Ships in debug-and-refactor. 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.
None: SKILL.md is the whole skill.
A systematic approach to diagnosing and resolving Kubernetes issues. Always start with the basics: check events and logs first.
What it means: Container repeatedly crashes and fails to start. Kubernetes restarts it with exponential backoff (10s, 20s, 40s... up to 5 minutes).
Common causes:
Debug steps:
# Check pod events and status
kubectl describe pod <pod-name> -n <namespace>
# View current and previous container logs
kubectl logs <pod-name> -n <namespace>
kubectl logs <pod-name> -n <namespace> --previous
# Check resource limits vs actual usage
kubectl top pod <pod-name> -n <namespace>
Solutions:
initialDelaySeconds and timeoutSecondsWhat it means: Kubernetes cannot pull the container image. Retries with increasing delay (5s, 10s, 20s... up to 5 minutes).
Common causes:
Debug steps:
# Check pod events for specific error
kubectl describe pod <pod-name> -n <namespace>
# Verify image name in deployment
kubectl get deployment <name> -n <namespace> -o yaml | grep image:
# Check if imagePullSecrets are configured
kubectl get pod <pod-name> -n <namespace> -o yaml | grep -A5 imagePullSecrets
# Test pulling image from node (if you have node access)
docker pull <image-name>
Solutions:
What it means: Pod cannot be scheduled to any node.
Common causes:
Debug steps:
# Check why pod is pending
kubectl describe pod <pod-name> -n <namespace>
# View cluster events
kubectl get events -n <namespace> --sort-by='.lastTimestamp'
# Check node resources
kubectl describe nodes | grep -A5 "Allocated resources"
kubectl top nodes
# Check PVC status if using persistent storage
kubectl get pvc -n <namespace>
Solutions:
What it means: Container was forcefully terminated (SIGKILL, exit code 137) for exceeding memory limit.
Common causes:
Debug steps:
# Check termination reason
kubectl describe pod <pod-name> -n <namespace> | grep -A10 "Last State"
# View logs before termination
kubectl logs <pod-name> -n <namespace> --previous
# Check memory limits vs usage
kubectl top pod <pod-name> -n <namespace>
kubectl get pod <pod-name> -n <namespace> -o yaml | grep -A5 resources:
Solutions:
What it means: Cannot connect to service from within or outside cluster.
Common causes:
Debug steps:
# Check service and endpoints
kubectl get svc <service-name> -n <namespace>
kubectl get endpoints <service-name> -n <namespace>
kubectl describe svc <service-name> -n <namespace>
# Verify pod labels match service selector
kubectl get pods -n <namespace> --show-labels
kubectl get svc <service-name> -n <namespace> -o yaml | grep -A5 selector
# Test connectivity from within cluster
kubectl run debug --rm -it --image=busybox -- wget -qO- http://<service-name>.<namespace>:port
# Check network policies
kubectl get networkpolicy -n <namespace>
Solutions:
What it means: PersistentVolumeClaim cannot bind to a PersistentVolume.
Common causes:
Debug steps:
# Check PVC status
kubectl get pvc -n <namespace>
kubectl describe pvc <pvc-name> -n <namespace>
# List available PVs
kubectl get pv
# Check StorageClass
kubectl get storageclass
kubectl describe storageclass <name>
# View provisioner events
kubectl get events -n <namespace> --field-selector reason=ProvisioningFailed
Solutions:
What it means: Service account lacks required permissions for API operations.
Common causes:
Debug steps:
# Check what service account pod uses
kubectl get pod <pod-name> -n <namespace> -o yaml | grep serviceAccountName
# Test permissions
kubectl auth can-i <verb> <resource> --as=system:serviceaccount:<namespace>:<sa-name>
# List roles and bindings
kubectl get roles,rolebindings -n <namespace>
kubectl get clusterroles,clusterrolebindings | grep <relevant-name>
# Describe specific binding
kubectl describe rolebinding <name> -n <namespace>
Solutions:
Get detailed information about any resource including events.
kubectl describe pod <pod-name> -n <namespace>
kubectl describe node <node-name>
kubectl describe svc <service-name> -n <namespace>
kubectl describe deployment <name> -n <namespace>
View container stdout/stderr logs.
kubectl logs <pod-name> -n <namespace>
kubectl logs <pod-name> -n <namespace> -c <container-name> # specific container
kubectl logs <pod-name> -n <namespace> --previous # previous instance
kubectl logs <pod-name> -n <namespace> -f # follow/stream
kubectl logs <pod-name> -n <namespace> --tail=100 # last 100 lines
kubectl logs -l app=myapp -n <namespace> # by label selector
Execute commands inside running container.
kubectl exec -it <pod-name> -n <namespace> -- /bin/sh
kubectl exec -it <pod-name> -n <namespace> -- /bin/bash
kubectl exec <pod-name> -n <namespace> -- cat /etc/config/app.conf
kubectl exec <pod-name> -n <namespace> -c <container> -- env # specific container
Debug nodes or pods with ephemeral containers (K8s 1.23+).
# Debug a running pod with ephemeral container
kubectl debug -it <pod-name> -n <namespace> --image=busybox --target=<container>
# Debug a node
kubectl debug node/<node-name> -it --image=busybox
# Create debug copy of pod with different image
kubectl debug <pod-name> -it --copy-to=debug-pod --container=app --image=busybox
View cluster events for troubleshooting.
kubectl get events -n <namespace>
kubectl get events -n <namespace> --sort-by='.lastTimestamp'
kubectl get events -n <namespace> --field-selector type=Warning
kubectl get events -n <namespace> -w # watch for new events
kubectl get events -A --sort-by='.lastTimestamp' | tail -20 # cluster-wide recent
View resource usage metrics (requires metrics-server).
kubectl top pods -n <namespace>
kubectl top pods -n <namespace> --sort-by=memory
kubectl top nodes
kubectl top pod <pod-name> -n <namespace> --containers
Start broad, then narrow down. Never assume the cause.
# Quick status overview
kubectl get pods,svc,deploy,rs -n <namespace>
# Recent events (often reveals the issue immediately)
kubectl get events -n <namespace> --sort-by='.lastTimestamp' | tail -20
# Describe the problematic resource
kubectl describe <resource-type> <name> -n <namespace>
Logs reveal application-level issues; metrics reveal resource issues.
# Application logs
kubectl logs <pod-name> -n <namespace> --tail=200
kubectl logs <pod-name> -n <namespace> --previous # if crashed
# Resource metrics
kubectl top pod <pod-name> -n <namespace>
kubectl top nodes
Get inside the environment when logs aren't enough.
# Shell into the container
kubectl exec -it <pod-name> -n <namespace> -- /bin/sh
# Use ephemeral debug container
kubectl debug -it <pod-name> -n <namespace> --image=nicolaka/netshoot
# Check connectivity from inside
wget -qO- http://service-name:port
nslookup service-name
curl -v http://endpoint
Make changes, verify they work, document the solution.
# Apply fix
kubectl apply -f fixed-manifest.yaml
# Watch for success
kubectl get pods -n <namespace> -w
kubectl get events -n <namespace> -w
# Verify health
kubectl logs <pod-name> -n <namespace> -f
# Get all pods with their status across namespaces
kubectl get pods -A -o wide
# Find pods not in Running state
kubectl get pods -A --field-selector=status.phase!=Running
# Get pod restart counts
kubectl get pods -n <namespace> -o=custom-columns='NAME:.metadata.name,RESTARTS:.status.containerStatuses[0].restartCount'
# Show pod resource requests and limits
kubectl get pods -n <namespace> -o=custom-columns='NAME:.metadata.name,MEM_REQ:.spec.containers[0].resources.requests.memory,MEM_LIM:.spec.containers[0].resources.limits.memory'
# Get events sorted by time (most recent last)
kubectl get events --sort-by='.lastTimestamp' -n <namespace>
# Watch pods in real-time
kubectl get pods -n <namespace> -w
# Get logs from all pods with label
kubectl logs -l app=myapp -n <namespace> --all-containers=true
# Check endpoints for a service
kubectl get endpoints <service-name> -n <namespace>
# Test DNS resolution
kubectl run dnstest --rm -it --image=busybox --restart=Never -- nslookup <service-name>.<namespace>
# Check RBAC permissions
kubectl auth can-i --list --as=system:serviceaccount:<namespace>:<sa-name>
# Run network debug pod
kubectl run netshoot --rm -it --image=nicolaka/netshoot -- /bin/bash
# Test service connectivity
kubectl run curl --rm -it --image=curlimages/curl -- curl -v http://<service>:<port>
# Check CoreDNS logs
kubectl logs -n kube-system -l k8s-app=kube-dns
# Trace network path
kubectl exec -it <pod> -- traceroute <destination>
# List all PVCs with status
kubectl get pvc -A
# Describe PVC for binding issues
kubectl describe pvc <name> -n <namespace>
# Check storage provisioner logs
kubectl logs -n kube-system -l app=<provisioner-name>
# Verify mount inside pod
kubectl exec -it <pod> -n <namespace> -- df -h
kubectl exec -it <pod> -n <namespace> -- ls -la /path/to/mount
| Image | Use Case |
|---|---|
busybox | Basic shell, networking tools |
nicolaka/netshoot | Comprehensive network debugging |
curlimages/curl | HTTP testing |
alpine | Minimal Linux with package manager |
gcr.io/kubernetes-e2e-test-images/jessie-dnsutils | DNS debugging |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/debug-and-refactor:debug:kubernetesfrom debug-and-refactor
npx claudepluginhub snakeo/claude-debug-and-refactor-skills-plugin --plugin debug-and-refactor45 skills in this plugin
/debug:angularDebug Angular applications systematically with expert-level diagnostic techniques. This skill provides comprehensive guidance for troubleshooting dependency injection errors, change detection issues (NG0100), RxJS subscription leaks, lazy loading failures, zone.js problems, and common Angular runtime errors. Includes structured four-phase debugging methodology, Angular DevTools usage, console debugging utilities (ng.probe), and performance profiling strategies for modern Angular applications./debug:djangoDebug Django web applications with systematic diagnostic approaches. This skill covers troubleshooting Django-specific errors including TemplateDoesNotExist, ImproperlyConfigured, IntegrityError, migration conflicts, CSRF failures, N+1 query problems, and circular imports. Includes Django Debug Toolbar setup, ORM query logging, pdb/ipdb usage, shell_plus debugging, and comprehensive logging configuration. Provides four-phase methodology for root cause analysis and regression prevention.Other plugins' skills for the same job
/debug:dockerDebug Docker containers, images, and infrastructure with systematic diagnostic techniques. This skill provides comprehensive guidance for troubleshooting container exit codes, OOM kills, image build failures, networking issues, volume mount problems, and permission errors. Covers four-phase debugging methodology from quick assessment to deep analysis, essential Docker commands, debug container techniques for minimal images, and platform-specific troubleshooting for Windows, Mac, and Linux.