0Pricing
DevOps Bootcamp · Lesson

Pod Lifecycle and States

Understand the various phases a Pod goes through and how to monitor its status.

Pod Lifecycle and States is a free DevOps Bootcamp lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Pods: A Journey Through Life

Pods aren't static; they go through different stages, much like a journey. Understanding this "lifecycle" is key to managing your applications effectively in Kubernetes.

It helps you know if your app is healthy, starting up, or has encountered a problem.

Pod Lifecycle and States — illustration 1

Pod's Five Life Stages

Kubernetes categorizes Pods into five main phases. These phases give us a high-level overview of a Pod's current state:

  • Pending: The Pod has been accepted by Kubernetes but its containers haven't started.
  • Running: At least one container in the Pod is running or starting.
  • Succeeded: All containers in the Pod completed successfully and will not restart.
  • Failed: All containers terminated, and at least one failed (e.g., exited with a non-zero code).
  • Unknown: The state of the Pod could not be determined, often due to communication issues.

Phase 1: Pending Pods

A Pod is in the Pending phase when it has been accepted by the Kubernetes API server but one or more of its containers has not yet been created or configured.

Common reasons include:

  • The container image is still being downloaded.
  • The cluster doesn't have enough resources (CPU/memory) to schedule the Pod.
  • Volumes are still being provisioned or mounted.

Observing a Pending Pod

Let's look at an example. If you try to deploy a Pod with an image that doesn't exist, it might get stuck in 'Pending' or show an image pull error.

Here's a sample Pod definition:

apiVersion: v1
kind: Pod
metadata:
  name: pending-pod-demo
spec:
  containers:
  - name: my-container
    image: non-existent-image:latest
    ports:
    - containerPort: 80

To check its status, you'd use kubectl get pod. You might see something like this:

$ kubectl get pod pending-pod-demo
NAME               READY   STATUS         RESTARTS   AGE
pending-pod-demo   0/1     ErrImagePull   0          5s

ErrImagePull indicates the image couldn't be fetched, causing the Pod to not reach the Running state.

Phase 2: Running Pods

The Running phase means the Pod has been bound to a node, and all of its containers have been successfully created. At least one container is running, or is in the process of starting or restarting.

It's important to note that a Running Pod doesn't automatically mean your application inside is healthy or fully functional. It just means the containers are active.

Getting a Pod Running

Here's a standard Pod definition for an Nginx web server. After applying this, your Pod should quickly enter the 'Running' state.

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
spec:
  containers:
  - name: nginx
    image: nginx:latest
    ports:
    - containerPort: 80

Once deployed, using kubectl get pod would show:

$ kubectl get pod nginx-pod
NAME        READY   STATUS    RESTARTS   AGE
nginx-pod   1/1     Running   0          10s

The 1/1 in READY confirms one container is ready out of one defined.

Phase 3 & 4: Succeeded & Failed

These phases represent the termination states for a Pod:

  • Succeeded: A Pod enters this phase when all containers in it have terminated successfully, and will not be restarted. This is typical for Pods running one-off tasks or batch jobs.
  • Failed: A Pod is in the Failed phase when all containers in the Pod have terminated, and at least one container has terminated in failure (e.g., exited with a non-zero status code).

Understanding these helps you diagnose job completion or application errors.

The Mysterious Unknown Phase

The Unknown phase means the state of the Pod could not be determined. This is a rare but critical phase.

It usually happens when the Kubelet (the agent) on the node where the Pod is running stops communicating with the Kubernetes API server. This might be due to a network issue, a crashed Kubelet, or a problem with the node itself.

Container States within Pods

While Pods have overall phases, individual containers inside a Pod also have their own more granular states. These states directly influence the overall Pod phase:

  • Waiting: The container is currently waiting to start. Reasons include image pull, resource allocation, or waiting for init containers to complete.
  • Running: The container is actively executing without issues.
  • Terminated: The container has completed its execution. It might have succeeded or failed.

Pod State Check

Imagine you've just deployed a new Pod. You run kubectl get pod my-app and see the following output:

NAME      READY   STATUS     RESTARTS   AGE
my-app    0/1     Pending    0          12s

What is the most likely reason for the my-app Pod being in the Pending state with 0/1 ready containers?

Lifecycle Recap & Next Steps

You've learned that Kubernetes Pods progress through distinct phases: Pending, Running, Succeeded, Failed, and Unknown. These phases provide high-level insights into a Pod's operational status.

We also touched on individual container states (Waiting, Running, Terminated), which contribute to the Pod's overall phase. Monitoring these states with kubectl get pod and kubectl describe pod (which you'll explore more later!) is crucial for understanding your application's health.

Next, we'll dive into advanced Pod patterns, exploring how to run multiple co-located containers within a single Pod using the sidecar pattern!

Frequently asked questions

Is the “Pod Lifecycle and States” lesson free?

Yes — the full text of “Pod Lifecycle and States” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.

What will I learn in “Pod Lifecycle and States”?

Understand the various phases a Pod goes through and how to monitor its status. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Pod Lifecycle and States” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Pods: The Smallest Unit
  2. Pod Lifecycle and States
  3. Multi-Container Pods (Sidecars)
  4. Init Containers and Startup Ordering
← Back to DevOps Bootcamp