kubectl describe: Debug Resources in CI
Print a detailed, human-readable view of a resource, including its recent events.
kubectl describe shows a resource plus the events the scheduler and kubelet emitted about it, which is the fastest way to find out why a pod is Pending or crashing. In CI it is run on failure to dump diagnostic context into the job log.
Common flags
TYPE NAME- e.g. pod my-pod (positional)-n NAMESPACE- target namespace-l key=value- describe all resources matching a selector
Example in CI
Dump events for failing api pods when a deploy fails.
shell
kubectl describe pod -l app=api -n prodCommon errors in CI
- Error from server (NotFound): pods "X" not found - wrong name or namespace
- the server doesn't have a resource type "X" - misspelled resource kind
- Events show FailedScheduling / Insufficient cpu - no node can satisfy the pod requests
Key takeaways
- Shows resource detail plus events; the fastest path to a root cause.
- Run it on failure to capture why pods are Pending or crashing.
- The Events section is where scheduling and image-pull failures surface.
Related guides
kubectl get pods: Inspect Pods in CIList and inspect pods in CI: output and selector flags, a scripting example, and the errors that point to acc…
kubectl logs: Capture Container Logs in CIFetch container logs in CI: selector, previous, and tail flags, a debug example, and the errors you hit when…
kubectl exec: Run Commands in Pods in CIExecute a command inside a running pod from CI: container and stdin flags, a migration example, and the error…