Pods: The Atomic Unit of Deployment
What you'll learn: How Kubernetes organizes containers into pods—the smallest deployable units that share resources and have a lifecycle.
What is a Pod?
In Kubernetes, a pod is the smallest unit you can create or deploy. While Docker deals with individual containers, Kubernetes wraps one or more containers into a pod. Think of a pod as a "household" where containers are roommates sharing the same living space—they share the same network address and can access the same storage volumes.
Why Group Containers?
Most commonly, a pod contains a single container running your application. However, some applications need helper containers (called "sidecars") that work closely together. For example, your main web server container might need a logging agent container to ship logs. These containers need to communicate efficiently and share data, so they live in the same pod.
Shared Resources
Containers in a pod share:
- Network namespace: They communicate via
localhostand share the same IP address - Storage volumes: They can read/write to the same mounted volumes
- IPC (inter-process communication): Efficient local communication
Pod Lifecycle
Pods are ephemeral and disposable. When a pod starts, Kubernetes assigns it to a node and it runs until:
- Its containers complete successfully
- A container fails and the restart policy says not to retry
- The pod is deleted manually or by a controller
- The node fails
When a pod dies, Kubernetes doesn't "revive" it—it creates a brand new pod with a new IP address. This is why pods are considered "cattle, not pets."
Key Takeaway: Pods are Kubernetes' atomic deployment unit, grouping one or more tightly-coupled containers that share networking and storage, with an ephemeral lifecycle managed by the cluster.