Kubernetes pod lifecycle: Phases, states and transitions explained
Understand the complete Kubernetes pod lifecycle from creation through scheduling to termination. Covers pod phases, liveness and readiness probes, init containers, hooks, and restart policies.
9 lessons · 27 min · Intermediate
Written by
Marketing Team at Civo
Written by
Marketing Team at Civo
When you create a pod, it does not immediately start running. It moves through a series of phases as Kubernetes schedules it, pulls the container image, starts the container, and eventually terminates it. Understanding these phases helps you diagnose problems and reason about pod behaviour.
Pod phases at a glance
What happens when you create a pod
When you run kubectl apply -f pod.yaml or kubectl create -f pod.yaml, the following sequence happens:
kubectl apply -f pod.yaml
- kubectl converts the YAML to JSON and sends it to the API server
- The API server authenticates the request using your kubeconfig credentials
- The API server checks whether the user is authorised to create a pod
- Admission controllers run any cluster-level policy checks
- The pod object is persisted to etcd and enters Pending state
- The scheduler watches for unscheduled pods, finds the best available node based on resource requirements and constraints, and updates the pod spec with the node name
- The updated pod object is stored in etcd
- The API server notifies the kubelet on the selected node
- The kubelet instructs the container runtime to pull the image from the registry
- The CNI plugin assigns an IP address to the pod and reports it back to the API server
- The pod moves to ContainerCreating then Running once the container starts
Watch the phase transitions in real time:
kubectl get pods -w
Observing pod state
Check the current state of all pods:
kubectl get pods
Expected output:
NAME READY STATUS RESTARTS AGEsample-pod 1/1 Running 0 2m
Get detailed information including events:
kubectl describe pod sample-pod
The Events section at the bottom shows each step: node assignment, image pull, container creation, and start. When a pod is stuck in any state, the Events section usually explains why.
Restart policies
The restart policy controls what Kubernetes does when a container inside a pod exits. Set it in the pod spec under spec.restartPolicy.
Example pod with OnFailure restart policy:
apiVersion: v1kind: Podmetadata:name: batch-jobspec:restartPolicy: OnFailurecontainers:- name: workerimage: busyboxcommand: ["sh", "-c", "echo processing && exit 0"]
CrashLoopBackOff
If a container crashes and restarts too many times in quick succession, Kubernetes puts it into CrashLoopBackOff. This is not a phase but a status that indicates Kubernetes is backing off restart attempts with increasing delays to prevent overwhelming the system.
kubectl get pods
Example output showing CrashLoopBackOff:
NAME READY STATUS RESTARTS AGEbroken-pod 0/1 CrashLoopBackOff 5 3m
Diagnose the cause:
kubectl logs broken-pod
If the container has already restarted, check the previous container's logs:
kubectl logs broken-pod --previous
Hooks
Kubernetes supports two lifecycle hooks that run commands at specific points in the container lifecycle.
PostStart runs immediately after the container starts. It runs concurrently with the container's main process. If it fails, the container is killed.
PreStop runs immediately before the container receives a SIGTERM signal. Use it to gracefully drain connections or flush in-flight requests before shutdown. Without it, a rolling update may drop in-flight requests.
spec:containers:- name: nginximage: nginxlifecycle:postStart:exec:command: ["sh", "-c", "echo container started"]preStop:exec:command: ["sh", "-c", "nginx -s quit && sleep 5"]
Init containers and probes
Init containers run to completion before the main container starts. They are useful for pre-conditions like waiting for a dependency to be ready. See Kubernetes init containers for working examples.
Liveness and readiness probes tell Kubernetes whether a container is healthy and ready to receive traffic. A failed liveness probe causes the container to be restarted. A failed readiness probe removes the pod from service endpoints without restarting it. See Kubernetes container probes for a full guide.

Marketing Team at Civo
Civo is the Sovereign Cloud and AI platform designed to help developers and enterprises build without limits. We bridge the gap between the openness of the public cloud and the rigorous security of private environments, delivering full cloud parity across every deployment. As a team, we are dedicated to providing scalable compute, lightning-fast Kubernetes, and managed services that are ready in minutes. Through CivoStack Enterprise and our FlexCore appliance, we empower organizations to maintain total data sovereignty on their own hardware.
Our mission is to make the cloud faster, simpler, and fairer. By providing enterprise-grade NVIDIA GPUs and streamlined model management, we ensure that high-performance AI and machine learning are accessible to everyone. Built for transparency and performance, the Civo Team is here to give you total control over your infrastructure, your data, and your spend.
Share this lesson