Kubernetes Pod Lifecycle
Explain the different phases of a Kubernetes Pod lifecycle and what happens during each phase.
Explain the different phases of a Kubernetes Pod lifecycle and what happens during each phase.
A Kubernetes Pod goes through several phases: Pending (waiting for scheduling or image pulls), Running (at least one container is running), Succeeded (all containers terminated successfully), Failed (at least one container failed), and Unknown (Pod state cannot be determined). Each phase reflects the Pod's current status in the cluster.
Understanding Pod lifecycle is crucial for debugging applications and implementing proper health checks. The lifecycle begins when a Pod is created and ends when it's deleted or evicted. During this time, Kubernetes continuously monitors and manages the Pod's state through its control loops.
Check Pod phase
Pod with lifecycle hooks
- Confusing Pod phase with container state - a Running Pod can have containers in different states
- Not implementing graceful shutdown handlers, leading to data loss
- Setting terminationGracePeriodSeconds too low for applications that need cleanup time
- What is the difference between a Pod restart policy of Always, OnFailure, and Never?
- How do liveness and readiness probes affect the Pod lifecycle?
- What happens when a Pod's container exceeds its memory limit?
More Kubernetes interview questions
Also worth your time on this topic
Container Orchestration Basics
What is container orchestration and why do we need it? Name some common orchestration platforms.
junior
How to Cleanly List All Containers in a Kubernetes Pod
Learn several ways to list all containers in a Kubernetes pod using kubectl and JSONPath, with practical examples for real-world troubleshooting and automation.
Kubernetes Security Checklist
Essential security checklist for Kubernetes clusters to ensure production readiness.
1-2 hours