dot_config/opencode/skills/analyzing-k8s-events/SKILL.md
Analyzes Kubernetes cluster events to understand what happened and when. Use when investigating incidents, checking warnings, building event timeline, or understanding cluster activity.
npx skillsauth add rio/dotfiles analyzing-k8s-eventsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Investigates cluster and namespace events to build timeline and identify issues.
# Recent events in namespace (sorted by time)
kubectl get events -n <ns> --sort-by=.lastTimestamp
# Recent events cluster-wide
kubectl get events -A --sort-by=.lastTimestamp | head -50
# Warning events only
kubectl get events -n <ns> --field-selector type=Warning
# Events in last hour
kubectl get events -n <ns> --sort-by=.lastTimestamp | head -30
# Events for specific pod
kubectl get events -n <ns> --field-selector involvedObject.name=<pod>
# Events for specific deployment
kubectl get events -n <ns> --field-selector involvedObject.name=<deployment>,involvedObject.kind=Deployment
# Events for specific PVC
kubectl get events -n <ns> --field-selector involvedObject.kind=PersistentVolumeClaim
# Warning events (problems)
kubectl get events -n <ns> --field-selector type=Warning
# Normal events
kubectl get events -n <ns> --field-selector type=Normal
# Common failure reasons
kubectl get events -A --field-selector reason=Failed
kubectl get events -A --field-selector reason=FailedScheduling
kubectl get events -A --field-selector reason=FailedMount
kubectl get events -A --field-selector reason=BackOff
kubectl get events -A --field-selector reason=Unhealthy
kubectl get events -A --field-selector reason=OOMKilling
| Reason | Meaning | Action |
|--------|---------|--------|
| FailedScheduling | No node can run pod | Load debugging-k8s-scheduling |
| FailedMount | Volume mount failed | Load debugging-k8s-storage |
| BackOff | Container crashing | Load debugging-k8s-pods |
| Unhealthy | Probe failing | Check liveness/readiness probe |
| Killing | Pod being terminated | Check termination reason |
| Pulled | Image pulled successfully | Informational |
| Created | Container created | Informational |
| Started | Container started | Informational |
# Wide output with timestamps
kubectl get events -n <ns> --sort-by=.lastTimestamp -o wide
# Custom columns for analysis
kubectl get events -n <ns> --sort-by=.lastTimestamp \
-o custom-columns=TIME:.lastTimestamp,TYPE:.type,REASON:.reason,OBJECT:.involvedObject.name,MESSAGE:.message
# Events mentioning a specific string
kubectl get events -n <ns> -o json | jq '.items[] | select(.message | contains("<search-term>"))'
# Or using grep
kubectl get events -n <ns> --sort-by=.lastTimestamp -o wide | grep <term>
# Full event details (JSON)
kubectl get events -n <ns> --field-selector involvedObject.name=<resource> -o json
# Key fields to examine:
# - reason: short reason code
# - message: detailed message
# - type: Normal or Warning
# - count: how many times this event occurred
# - firstTimestamp/lastTimestamp: time range
Events are stored in etcd with limited retention (default ~1 hour). For older events:
# 1. Get recent warnings
kubectl get events -n <ns> --field-selector type=Warning --sort-by=.lastTimestamp
# 2. Focus on specific resource
kubectl get events -n <ns> --field-selector involvedObject.name=<resource> --sort-by=.lastTimestamp
# 3. Get full details if needed
kubectl describe <resource-type> <resource-name> -n <ns>
documentation
Compact the current conversation into a handoff document for another agent to pick up.
development
Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.
testing
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".
development
Retrieves Kubernetes container logs with various patterns including multi-container pods, previous container logs, init containers, and label-based aggregation. Use when checking application logs, debugging crashes, or analyzing container output.