Back to Blog
Lesson 12 of the Kubernetes: Kubernetes Concepts & Your First Pod course
KubernetesJuly 30, 20264 min read

The Pod Lifecycle: Understanding Phases and Troubleshooting States

Master the Kubernetes Pod lifecycle. Learn to identify Pending, Running, Succeeded, and Failed phases and resolve container crash states in your clusters.

KubernetesPodsTroubleshootingDevOpsLifecycleContainers
Flat lay of product lifecycle diagram and pencil on a wooden desk.

Previously in this course, we covered Applying Manifests to the Cluster, where we moved from theory to creating our first active resources. Now that you can launch a Pod, you need to understand what happens after the kubectl apply command finishes.

In Kubernetes, a Pod isn't just "on" or "off." It moves through a specific, defined lifecycle. Understanding these states is the first step in effective troubleshooting and cluster management.

The Four Pod Phases

When you run kubectl get pods, the STATUS column doesn't just show "Running." Kubernetes tracks the Lifecycle of a Pod using four distinct phases:

PhaseDescription
PendingThe Pod is accepted by the cluster, but one or more containers haven't started. This often means the image is still downloading or the scheduler is finding a node.
RunningThe Pod has been bound to a node, and all containers have been created. At least one container is currently running or starting up.
SucceededAll containers in the Pod have terminated successfully with an exit code of 0. This is typical for Jobs or batch tasks.
FailedAll containers have terminated, and at least one container terminated with a non-zero exit code (an error).

Behind the Scenes: Container States

Long freight train passing through snowy Truckee, California with mountains in the background.

While the Pod has a phase, the containers inside it have their own granular states. You'll often see a Pod in a "Running" phase, but the container inside might be stuck in a restart loop.

To see the real story, we don't just use kubectl get. We use kubectl describe pod <pod-name>.

Worked Example: Identifying a Crash

Let’s look at what happens when a container fails. Imagine you have a Pod manifest that tries to run a command that doesn't exist.

  1. Create a file named crash-pod.yaml:
YAML
apiVersion: v1
kind: Pod
metadata:
  name: crash-demo
spec:
  containers:
  - name: busybox
    image: busybox
    command: ["/bin/false"] # This command exits immediately with an error
  1. Apply it: kubectl apply -f crash-pod.yaml
  2. Check the status: kubectl get pod crash-demo

You will likely see CrashLoopBackOff. This is the most common troubleshooting state you'll encounter. It means the container started, crashed, and Kubernetes is attempting to restart it, backing off the interval between retries to prevent overwhelming the node.

  1. Peek into the details: kubectl describe pod crash-demo

Look at the Containers section in the output. You’ll see:

  • State: Waiting (Reason: CrashLoopBackOff)
  • Last State: Terminated (Reason: Error, Exit Code: 1)

This tells you exactly what happened: the process finished with a non-zero exit code, and Kubernetes is trying to recover.

Hands-on Exercise

To solidify your understanding of these states, perform the following steps:

  1. Create a "Succeeded" Pod. Use the busybox image but change the command to ["/bin/sh", "-c", "echo 'Hello World'"].
  2. Watch the lifecycle: Run kubectl get pod -w (the -w flag watches for changes).
  3. Notice how the status transitions from Pending -> Running -> Succeeded.
  4. Once it reaches Succeeded, run kubectl describe pod <pod-name> and look for the Status and Reason fields.

Common Pitfalls

  • Confusing "Pending" with "Broken": A Pod in Pending isn't necessarily broken. It might just be waiting for a large image to pull over a slow network. Always check the Events section at the bottom of kubectl describe before assuming the cluster is down.
  • Ignoring Exit Codes: If your Pod is in Failed or CrashLoopBackOff, the exit code is your best clue. An exit code of 1 is a generic error, while 137 often indicates an OOMKilled (Out of Memory) event.
  • The "Running" Trap: A Pod can be in the Running phase even if the application inside is deadlocked or crashed. The Running phase just means the container process is active, not that your code is behaving correctly.

FAQ

Why does my Pod stay in Pending forever? Usually, this means the scheduler cannot place the Pod. Check for insufficient CPU/Memory on your nodes or issues with persistent volume claims.

What is the difference between Failed and Unknown? Failed means the container finished and reported an error. Unknown means the API server cannot communicate with the node where the Pod is running (often a network partition or a node crash).

How do I stop a CrashLoopBackOff? You must fix the underlying issue in your manifest (like a bad command or missing environment variable) and re-apply the YAML. Simply deleting the Pod won't fix it if the manifest itself is the source of the error.

Recap

The Pod Lifecycle is managed by the Kubernetes control plane to ensure your desired state is maintained. By monitoring Pod phases and inspecting container states with kubectl describe, you can quickly distinguish between scheduling issues (Pending), transient failures (CrashLoopBackOff), and successful completion (Succeeded). Mastering these troubleshooting signals is what separates a beginner from a productive cluster operator.

Up next: We will dive into Container Image Pull Policies to understand how Kubernetes decides when to download fresh code for your Pods.

Similar Posts