Kubernetes Pods
Understand what a Pod is, why Kubernetes schedules pods instead of raw containers, and how containers share networking and storage inside a pod.
What Is a Pod?
A Pod is the smallest deployable unit in Kubernetes. It wraps one or more tightly related containers that should run together on the same node.
Why Pods Instead of Containers Directly?
Kubernetes needs a scheduling unit that can include more than one cooperating container when necessary. A pod gives Kubernetes that unit.
Examples:
- one app container by itself
- an app container plus a sidecar log shipper
- an app container plus a local proxy
Shared Context Inside a Pod
Containers in the same pod share:
- the same network namespace
- the same pod IP address
- the ability to use shared volumes
That means one container can reach another on localhost inside the same pod.
Pod anatomy
Init Container
Runs to completion before main containers start
Container 1 — main app
Your application process
Container 2 — sidecar
e.g. log forwarder, proxy
Shared network
Same IP & ports
Shared volumes
emptyDir / PVC
Pod IPs and Ephemeral Nature
Each pod gets an IP address, but pods are ephemeral. If a pod is replaced, the replacement usually gets a different IP.
That is why higher-level resources such as Services exist. Services give stable access even when individual pod IPs change.
Sub-pages in This Section
| Sub-topic | What you will learn |
|---|---|
| Pod Manifest | Write and read complete Pod YAML |
| Pod Lifecycle | Understand phases, states, and restart behavior |
| Multi-container Pods | Sidecars, init containers, and shared volumes |
| Probes | Use liveness, readiness, and startup probes |
When Not to Use Bare Pods
You can create a pod directly, but for most applications you should use a Deployment. Deployments recreate failed pods and manage rolling updates.
Mental Model
Think of a pod as a tiny shared apartment for one or more containers. They can share an address and storage, but they come and go as one unit.
Smallest Unit
What is the smallest deployable unit in Kubernetes?
Shared Pod Feature
What do containers inside the same pod share?