Kubernetes Curriculum
On this page
What Is A Pod
A Pod is the smallest deployable unit in Kubernetes. Everything you run in Kubernetes — whether a web server, a database, a batch job, or a monitoring agent — runs inside a Pod. You cannot run a container directly in Kubernetes without a Pod wrapping it.
Understanding Pods deeply is the foundation of everything else in Kubernetes. Before you can understand Deployments, StatefulSets, Services, or health checks, you need to know exactly what a Pod is, what it contains, and how Kubernetes thinks about it.
What a Pod Actually Is
A Pod is a wrapper around one or more containers that share the same:
- Network namespace — all containers in a Pod share the same IP address and port space
- Storage — containers in a Pod can share volumes (filesystem directories)
- Lifecycle — all containers in a Pod are created and destroyed together
The word "Pod" comes from a pod of whales or a pea pod — a group of things that naturally belong together.
In almost all cases, a Pod contains exactly one container. Multi-container Pods are a specific pattern used in specific situations — covered in 03-multi-container-pods.md.
Why Pods Exist — The Design Reason
You might wonder: why does Kubernetes not just run containers directly? Why the extra layer?
The reason is that some applications need tightly-coupled helper processes that must run on the same machine and share the same network. For example:
- A web application container and a log-shipping sidecar that reads the same log files
- A service container and an Envoy proxy container that intercepts all its network traffic
- An application container and an init container that pre-populates a config file before the app starts
By grouping these into a Pod, Kubernetes guarantees they are always co-located on the same node, share the same network interface, and share volumes. You get tight coupling where you need it, without abandoning the separation that containers provide.
For 95% of use cases, you have one container per Pod, and this co-location behavior is irrelevant. But the Pod abstraction exists for the 5% where it matters greatly.
Your First Pod YAML
Every Kubernetes object is described in YAML. Here is the simplest valid Pod definition:
Apply it:
Check it:
1/1 means 1 out of 1 containers in the Pod is ready and running.
The Key Fields of a Pod
apiVersion and kind
Pods use the core API group (v1). The kind tells Kubernetes what type of object this is.
metadata
Labels are used by Services and Deployments to find Pods. Annotations store metadata that is not used for selection — documentation, build info, tool-specific config.
spec.containers
The containers field is a list. Each item in the list defines one container:
spec.volumes
Volumes are defined at the Pod level and mounted into containers:
A Complete, Production-Style Pod
Here is what a real-world Pod specification looks like:
Pods Are Ephemeral — This is Critical to Understand
Pods are designed to be temporary. They can be created, destroyed, and replaced at any time. This is intentional and important:
- When you update a Deployment, old Pods are deleted and new ones are created
- When a node fails, its Pods are terminated and new Pods are scheduled on other nodes
- When the cluster auto-scales down, Pods on removed nodes are terminated
A Pod does not have a permanent identity. Every time a Pod is created, it gets a new random name (like web-deployment-7d6f8b-x2k9p) and a new IP address.
This means:
- Never connect to a Pod directly by IP — use a Service instead
- Never store permanent data in a Pod's local filesystem — it will be lost when the Pod is deleted. Use PersistentVolumes.
- Never assume a Pod will always be on the same node — Kubernetes can reschedule it anywhere
Interacting With Pods
Pod Status Values
Summary
- A Pod is the smallest deployable unit in Kubernetes — every container runs inside a Pod
- Pods share network (same IP), storage (volumes), and lifecycle across all their containers
- The Pod YAML has four key sections:
apiVersion,kind,metadata, andspec - The
spec.containerslist defines each container with its image, ports, environment variables, resources, health probes, and volume mounts - Pods are ephemeral — they are created and destroyed constantly. Never use a Pod's IP directly. Never store permanent data in a Pod's local filesystem.
- Common Pod statuses: Running, Pending, CrashLoopBackOff, ImagePullBackOff, OOMKilled
- Core commands:
kubectl get pods,kubectl describe pod,kubectl logs,kubectl exec
In the next file, 02-pod-lifecycle.md, you will learn the exact phases a Pod goes through from creation to termination — including what happens during graceful shutdown and why terminationGracePeriodSeconds matters for zero-downtime deployments.