Debugging Kubernetes pods

Current state of pods

Check the current state of a pod and recent events using the following command:

kubectl describe pods POD_NAME -n NAMESPACE


  • POD_NAME - Kubernetes pod name
  • NAMESPACE - Kubernetes namespace

My pod is crashing or is unhealthy

First, take a look at the logs of a container. To do so, execute:

kubectl logs POD_NAME -n NAMESPACE

If the container crashed, You can access the container’s previous crash log with:

kubectl logs --previous POD_NAME -n NAMESPACE