1/860 min
Primitives
Pods β The Atomic Unit
The smallest deployable unit in Kubernetes.
beginner60 minRead β Lab β Quiz β Practice
π§ Brain Warm-Up
π§ Brain Warm-Up: If a Pod contains multiple containers (e.g. an API server and a logging agent), how do they communicate with each other? Can they listen on the same port? Think about their network boundaries before reading.
What is a Pod?
A Pod is the smallest deployable unit in Kubernetes. It wraps one or more containers that share the same network namespace, IP address, and storage volumes.
Key facts:
- Every Pod gets one IP address β all containers inside share it.
- Containers in the same Pod communicate via localhost on different ports. They cannot bind to the same port.
- Pods are ephemeral β when they die, their filesystem is gone.
- In practice, you almost never create bare Pods β you use Deployments instead.
Pod vs Container
| Feature | Docker Container | Kubernetes Pod |
|---|---|---|
| Network | Its own IP | Shared with all co-located containers |
| Lifecycle | Individual | All containers start/stop together |
| Management | Manual | Orchestrated by Kubernetes |
Pod Architecture (Shared Network & Storage)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β POD β β IP Address: 10.244.1.5 (Shared Network Namespace) β β β β βββββββββββββββββββββββββ βββββββββββββββββββββββββ β β β Primary Container β β Sidecar Container β β β β (e.g., Node.js API) β β (e.g., Logging Agent)β β β β Port: 8080 β β Port: 9000 β β β ββββββββββββ¬βββββββββββββ βββββββββββββ¬ββββββββββββ β β β (Communicate via localhost)β β β βββββββββββββββΊβββββββββββββββ β β β β β β ββββββββββββΌβββββββββββββ βββββββββββββΌββββββββββββ β β β Volume Mount β β Volume Mount β β β ββββββββββββ¬βββββββββββββ βββββββββββββ¬ββββββββββββ β β β β β β βββββββββββββββΊβββββββββββββββ β β β β β ββββββββββΌβββββββββ β β β emptyDir Vol β β β βββββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Pod Lifecycle
Pending β Running β Succeeded
β
Failed β (restart policy)- Pending β scheduled but waiting for image pull or resources.
- Running β at least one container is running.
- Succeeded β all containers exited with code 0.
- Failed β at least one container exited non-zero.