Pods & Containers: Kubernetes's Smallest Unit
Pods are the smallest deployable unit in Kubernetes: one or more containers sharing a network namespace and optional storage. Understanding Pod lifecycle, init containers, and multi-container patterns is essential for debugging and design.
Pods & Containers: Kubernetes's Smallest Unit
Pods are the smallest deployable unit in Kubernetes: one or more containers sharing a network namespace and optional storage. Understanding Pod lifecycle, init containers, and multi-container patterns is essential for debugging and design.
What you'll learn
- Pods are ephemeral; they are created and destroyed frequently as part of normal operations
- All containers in a Pod share network namespace and lifecycle—if one crashes, all are restarted
- Single-container Pods are simplest; multi-container Pods should only be used for tightly-coupled helpers
- Init containers are useful for setup tasks that must complete before the app starts
- Resource limits and QoS classes determine how aggressively a Pod will be evicted under pressure
Lesson outline
What is a Pod?
A Pod is a wrapper around one or more containers. All containers in a Pod share the same network namespace, meaning they share an IP address and can communicate via localhost.
Pods are ephemeral: they are created and destroyed frequently. They are not meant to be long-lived entities you manage directly.
Single-Container vs Multi-Container Pods
Most Pods run a single container (the application). This is the simplest and most common pattern.
Multi-container Pods (sidecars) run a main application plus helper containers (logging, monitoring, security). ALL containers in a Pod share lifecycle: if one crashes, the Pod restarts.
Init Containers
Init containers run before the main application container starts. They are useful for setup tasks (database migrations, downloading config files, etc.).
If an init container fails, the Pod never becomes Ready. This provides feedback that setup failed.
Pod Lifecycle and Phases
Pending: Pod is being scheduled or containers are being pulled.
Running: At least one container is running.
Succeeded: All containers exited with status 0 (used for batch jobs).
Failed: At least one container exited with non-zero status.
Unknown: Communication problem with the node.
QoS Classes
Guaranteed: Pod with requests == limits for all containers (highest priority, least likely to be evicted).
Burstable: Pod with some requests/limits defined (medium priority).
BestEffort: Pod with no requests/limits (lowest priority, first to be evicted under resource pressure).
Key takeaways
- Pods are ephemeral; they are created and destroyed frequently as part of normal operations
- All containers in a Pod share network namespace and lifecycle—if one crashes, all are restarted
- Single-container Pods are simplest; multi-container Pods should only be used for tightly-coupled helpers
- Init containers are useful for setup tasks that must complete before the app starts
- Resource limits and QoS classes determine how aggressively a Pod will be evicted under pressure
💡 Analogy
A Pod is like an apartment unit containing one or more roommates (containers). All roommates share the same address (IP), can hear each other (localhost), and can access shared storage (volumes). If one roommate leaves (container stops), the apartment still exists until explicitly torn down. The apartment is ephemeral—you don't store important things inside; instead, use external storage (garage = PersistentVolume).
⚡ Core Idea
Pod = shared network namespace + optional shared storage, containing 1+ containers. Containers in a Pod can communicate via localhost. Pods are cattle, not pets: they're disposable and get recreated constantly.
🎯 Why It Matters
Pod design decisions (single-container vs sidecar) affect observability, security, and deployment complexity. Misunderstanding Pod lifecycle causes common failures (assuming Pod persistence, not understanding init containers, forgetting readiness probes).
Ready to see how this works in the cloud?
Switch to Career Paths for structured paths (e.g. Developer, DevOps) and provider-specific lessons.
View role-based pathsSign in to track your progress and mark lessons complete.
Discussion
Questions? Discuss in the community or start a thread below.
Join DiscordIn-app Q&A
Sign in to start or join a thread.