# 510 Kubernetes Troubleshooting 5f5d9509

> Kubernetes Troubleshooting

- Skill: `tools-only/510-kubernetes-troubleshooting-5f5d9509` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/510-kubernetes-troubleshooting-5f5d9509`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/510-kubernetes-troubleshooting-5f5d9509/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/tools-only/510-kubernetes-troubleshooting-5f5d9509

---

# Kubernetes Troubleshooting

## Debugging Workflow

```bash
# 1. Overview
kubectl get pods -o wide
kubectl get events -n <namespace> --sort-by='.lastTimestamp'

# 2. Details
kubectl describe pod <pod-name>

# 3. Logs
kubectl logs <pod-name>
kubectl logs <pod-name> --previous  # Crashed instance
kubectl logs <pod-name> -c <container>
```

## Common Pod States

| State | Cause | Solution |
|-------|-------|----------|
| Pending | No node resources | Check node capacity |
| ContainerCreating | Image pulling | Check image URI |
| CrashLoopBackOff | Container exits | Check logs, health checks |
| ImagePullBackOff | Failed image pull | Verify credentials |
| OOMKilled (137) | Out of memory | Increase memory limit |

## Service & Network

```bash
kubectl exec -it <pod-name> -- nslookup kubernetes.default
kubectl exec -it <pod-name> -- curl http://myservice:8080
kubectl get endpoints <service-name>
kubectl port-forward service/myservice 8080:8080
kubectl get networkpolicies -A
```

## Quick Fixes

| Problem | Command |
|---------|---------|
| Pod stuck | `kubectl delete pod <name> --grace-period=0 --force` |
| High CPU | `kubectl top pods -A --sort-by=cpu` |
| High memory | `kubectl top pods -A --sort-by=memory` |
| Restart | `kubectl rollout restart deployment/<name>` |
| Rollback | `kubectl rollout undo deployment/<name>` |

See `kubernetes-troubleshooting-advanced.md` for node issues, HPA, anti-patterns.

