Kubectl Troubleshooting

A systematic drill for CrashLoopBackOff and friends.

  • crashloopbackoff
  • imagepullbackoff
  • kubectl debug
  • troubleshoot pods
  • k8s events

Kubectl Troubleshooting

A systematic drill for CrashLoopBackOff and friends.

Commands

CommandWhat it does
`kubectl get pods -Agrep -v Running`Find unhealthy pods fast
kubectl describe pod <p>Events tell the story bottom-up
kubectl logs <p> --previousLogs of the crashed attempt
`kubectl get events --sort-by=.lastTimestamptail -30`Cluster-wide recent warnings
kubectl debug <p> -it --image=busybox --target=<c>Ephemeral debug container

Example

kubectl get pods -n shop | grep -v Running
kubectl describe pod api-xyz -n shop
kubectl logs api-xyz -n shop --previous | tail -50

FAQ

CrashLoopBackOff โ€” first three steps?

describe (events), logs --previous (crash output), then verify image, env, and probes โ€” in that order.

ImagePullBackOff โ€” causes?

Wrong tag, private registry without imagePullSecrets, or rate limits; describe shows the exact registry error.

Soalan Lazim

CrashLoopBackOff โ€” first three steps?
describe (events), logs --previous (crash output), then verify image, env, and probes โ€” in that order.
ImagePullBackOff โ€” causes?
Wrong tag, private registry without imagePullSecrets, or rate limits; describe shows the exact registry error.

Kubernetes