/k8s-toolkit:k8s-debugfrom k8s-toolkit
Kubernetes troubleshooting and debugging workflows. Use when diagnosing pod failures, networking issues, resource problems, CrashLoopBackOff, ImagePullBackOff, pending pods, OOMKilled, or any cluster issues. Covers systematic debugging approaches and common failure patterns.
Ships in k8s-toolkit. 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.
# Quick cluster health
kubectl get nodes
kubectl get pods -A | grep -v Running
kubectl get events -A --sort-by='.lastTimestamp' | tail -30
# Namespace health
kubectl get all -n <ns>
kubectl get events -n <ns> --sort-by='.lastTimestamp'
kubectl top pods -n <ns>
Symptoms: Pod restarts repeatedly, status shows CrashLoopBackOff
Diagnosis:
# Check exit code and reason
kubectl describe pod <pod> -n <ns> | grep -A10 "Last State"
# View logs from crashed container
kubectl logs <pod> -n <ns> --previous
# Check if OOMKilled
kubectl get pod <pod> -n <ns> -o jsonpath='{.status.containerStatuses[0].lastState.terminated.reason}'
Common Causes:
Fixes:
# Increase memory if OOMKilled
kubectl set resources deployment/<name> -n <ns> --limits=memory=1Gi
# Disable liveness probe temporarily for debugging
kubectl edit deployment/<name> -n <ns> # Remove livenessProbe
# Shell into running container to debug
kubectl exec -it <pod> -n <ns> -- /bin/sh
Symptoms: Pod stuck in ImagePullBackOff or ErrImagePull
Diagnosis:
kubectl describe pod <pod> -n <ns> | grep -A5 "Events"
# Look for: "Failed to pull image" messages
Common Causes:
Fixes:
# Verify image exists
docker pull <image>
# Check imagePullSecrets
kubectl get pod <pod> -n <ns> -o jsonpath='{.spec.imagePullSecrets}'
# Create registry secret
kubectl create secret docker-registry regcred \
--docker-server=<registry> \
--docker-username=<user> \
--docker-password=<pass> \
-n <ns>
# Add to deployment
kubectl patch deployment <name> -n <ns> -p '{"spec":{"template":{"spec":{"imagePullSecrets":[{"name":"regcred"}]}}}}'
Symptoms: Pod stuck in Pending state
Diagnosis:
kubectl describe pod <pod> -n <ns> | grep -A10 "Events"
# Look for scheduling failure reasons
Common Causes:
Fixes:
# Check node resources
kubectl describe nodes | grep -A5 "Allocated resources"
# Check taints
kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints
# Check PVC status
kubectl get pvc -n <ns>
# Check resource quota
kubectl describe resourcequota -n <ns>
Symptoms: Pod in CreateContainerConfigError state
Diagnosis:
kubectl describe pod <pod> -n <ns> | grep -A5 "Warning"
Common Causes:
Fixes:
# Check if configmap exists
kubectl get configmap <name> -n <ns>
# Check if secret exists
kubectl get secret <name> -n <ns>
# List expected volumes
kubectl get pod <pod> -n <ns> -o jsonpath='{.spec.volumes[*].name}'
Symptoms: Container terminated with OOMKilled reason, exit code 137
Diagnosis:
kubectl describe pod <pod> -n <ns> | grep -A5 "Last State"
kubectl top pod <pod> -n <ns>
# Check limits
kubectl get pod <pod> -n <ns> -o jsonpath='{.spec.containers[0].resources}'
Fixes:
# Increase memory limit
kubectl set resources deployment/<name> -n <ns> --limits=memory=2Gi
# Or patch
kubectl patch deployment <name> -n <ns> --type='json' -p='[
{"op":"replace","path":"/spec/template/spec/containers/0/resources/limits/memory","value":"2Gi"}
]'
Diagnosis:
# Check endpoints
kubectl get endpoints <service> -n <ns>
# Empty endpoints = selector mismatch or no ready pods
# Check service selector
kubectl get svc <service> -n <ns> -o jsonpath='{.spec.selector}'
# Check pod labels
kubectl get pods -n <ns> --show-labels
# Test from within cluster
kubectl run debug --rm -it --image=busybox -n <ns> -- wget -qO- <service>:<port>
Common Causes:
Fixes:
# Fix selector
kubectl patch svc <service> -n <ns> -p '{"spec":{"selector":{"app":"correct-label"}}}'
# Check readiness
kubectl get pods -n <ns> -o wide # Check READY column
kubectl describe pod <pod> -n <ns> | grep -A10 "Readiness"
Diagnosis:
# Test DNS from pod
kubectl run dns-test --rm -it --image=busybox -- nslookup kubernetes.default
kubectl run dns-test --rm -it --image=busybox -- nslookup <service>.<namespace>.svc.cluster.local
# Check CoreDNS
kubectl get pods -n kube-system -l k8s-app=kube-dns
kubectl logs -n kube-system -l k8s-app=kube-dns
Diagnosis:
# Check ingress status
kubectl describe ingress <name> -n <ns>
# Check ingress controller logs
kubectl logs -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx
# Verify backend service
kubectl get svc <backend-service> -n <ns>
kubectl get endpoints <backend-service> -n <ns>
Diagnosis:
kubectl describe pvc <name> -n <ns>
kubectl get storageclass
kubectl get pv
Common Causes:
Diagnosis:
kubectl describe pod <pod> -n <ns> | grep -A10 "Volumes"
kubectl describe pod <pod> -n <ns> | grep -A10 "Mounts"
kubectl get events -n <ns> | grep -i volume
Diagnosis:
kubectl describe node <node> | grep -A10 "Conditions"
kubectl get events --field-selector involvedObject.name=<node>
# Check kubelet logs (on node)
journalctl -u kubelet -n 100
Common Causes:
# Mark node unschedulable
kubectl cordon <node>
# Drain (evict pods)
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data
# Uncordon
kubectl uncordon <node>
# Node resources
kubectl top nodes
kubectl describe nodes | grep -A5 "Allocated resources"
# Pod resources
kubectl top pods -n <ns> --sort-by=memory
kubectl top pods -n <ns> --sort-by=cpu
# Resource quotas
kubectl describe resourcequota -n <ns>
kubectl describe limitrange -n <ns>
# Top memory consumers
kubectl top pods -A --sort-by=memory | head -20
# Top CPU consumers
kubectl top pods -A --sort-by=cpu | head -20
# Pods without limits
kubectl get pods -A -o json | jq -r '.items[] | select(.spec.containers[].resources.limits == null) | .metadata.namespace + "/" + .metadata.name'
# Add debug container to running pod
kubectl debug -it <pod> -n <ns> --image=busybox --target=<container>
# Debug with network tools
kubectl debug -it <pod> -n <ns> --image=nicolaka/netshoot --target=<container>
# Create copy with different command
kubectl debug <pod> -n <ns> --copy-to=debug-pod --container=<container> -- sleep infinity
# Then exec into it
kubectl exec -it debug-pod -n <ns> -- /bin/sh
# Network debugging
kubectl run netshoot --rm -it --image=nicolaka/netshoot -n <ns> -- /bin/bash
# Common debug commands inside:
curl -v http://<service>:<port>/
nslookup <service>
ping <pod-ip>
traceroute <service>
nc -zv <service> <port>
# Follow logs
kubectl logs -f <pod> -n <ns>
# All containers
kubectl logs <pod> -n <ns> --all-containers
# Previous container (after crash)
kubectl logs <pod> -n <ns> --previous
# Since time
kubectl logs <pod> -n <ns> --since=1h
kubectl logs <pod> -n <ns> --since-time="2024-01-01T00:00:00Z"
# Tail specific lines
kubectl logs <pod> -n <ns> --tail=100
# Multiple pods
kubectl logs -l app=<label> -n <ns> --all-containers
# With timestamps
kubectl logs <pod> -n <ns> --timestamps
# Namespace events
kubectl get events -n <ns> --sort-by='.lastTimestamp'
# Watch events
kubectl get events -n <ns> -w
# Filter warnings
kubectl get events -n <ns> --field-selector type=Warning
# Pod-specific events
kubectl get events -n <ns> --field-selector involvedObject.name=<pod>
#!/usr/bin/env bash
# k8s-diag.sh - Quick namespace diagnostic
NS="${1:?Usage: $0 <namespace>}"
echo "=== Namespace: $NS ==="
echo ""
echo "--- Pod Status ---"
kubectl get pods -n "$NS" -o wide
echo ""
echo "--- Non-Running Pods ---"
kubectl get pods -n "$NS" | grep -v Running | grep -v Completed
echo ""
echo "--- Recent Events ---"
kubectl get events -n "$NS" --sort-by='.lastTimestamp' | tail -20
echo ""
echo "--- Resource Usage ---"
kubectl top pods -n "$NS" 2>/dev/null || echo "Metrics not available"
echo ""
echo "--- Services ---"
kubectl get svc -n "$NS"
echo ""
echo "--- Endpoints ---"
kubectl get endpoints -n "$NS"
| Problem | Quick Fix |
|---|---|
| CrashLoopBackOff | kubectl logs <pod> --previous then fix app |
| ImagePullBackOff | Verify image name, create imagePullSecret |
| Pending (resources) | Scale down other pods or add nodes |
| Pending (PVC) | Check StorageClass and provisioner |
| OOMKilled | Increase memory limits |
| Readiness failing | Check probe endpoint, increase timeout |
| No endpoints | Fix service selector to match pod labels |
| DNS failure | Check CoreDNS pods in kube-system |
| Permission denied | Check RBAC, ServiceAccount |
What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/k8s-deploy-autoKubernetes deployment automation workflows for CI/CD pipelines, GitOps, and scripted deployments. Use when automating k8s deployments, creating deployment scripts, integrating with GitHub Actions/GitLab CI, implementing rollout strategies, or setting up ArgoCD/Flux workflows./k8s-manifestsGenerate Kubernetes manifest templates for deployments, services, configmaps, secrets, ingress, and other resources. Use when creating new k8s resources, scaffolding applications, or needing YAML templates. Triggers on requests to create, generate, or scaffold kubernetes resources./k8s-opsKubernetes cluster operations, deployments, and troubleshooting. Use when deploying manifests, checking rollout status, monitoring pods, debugging failures, viewing logs, managing namespaces, or any kubectl operations. Triggers on mentions of kubernetes, k8s, kubectl, pods, deployments, services, namespaces, or cluster management./k9s-uik9s terminal UI for Kubernetes cluster management. Use when navigating clusters interactively, viewing logs in real-time, managing resources through terminal UI, or when user mentions k9s, terminal kubernetes, or interactive cluster management. Covers keyboard shortcuts, navigation, plugins, and configuration./ssh-opsSSH operations for remote server management, tunneling, and proxy-based connections. Use when connecting to remote servers, running remote commands, setting up SSH tunnels, port forwarding, managing jump hosts/bastions, or executing kubectl/k9s on remote clusters. Triggers on SSH, remote, tunnel, bastion, jump host, port forward, or remote kubernetes access.npx claudepluginhub martin-janci/claude-marketplace --plugin k8s-toolkitOther plugins' skills for the same job