Pod Template Specification
What you'll learn: How to define the blueprint that tells your Deployment exactly what containers to run and how.
The Heart of Your Deployment
When you create a Deployment, you're not directly creating Pods—you're providing a template that Kubernetes uses to stamp out identical Pods. The pod template specification is this blueprint, nested inside your Deployment manifest under spec.template.
Think of it like a cookie cutter: the template defines the shape, and Kubernetes uses it to create as many identical cookies (Pods) as your ReplicaSet requires.
Core Components of the Pod Template
The pod template contains two essential sections:
Metadata
Defines labels that help organize and select Pods. These labels connect your Pods to Services and other resources:
template:
metadata:
labels:
app: myapp
tier: frontend
Spec
Defines what runs inside each Pod:
spec:
containers:
- name: nginx
image: nginx:1.21
ports:
- containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
Key fields:
containers: List of container definitions (at least one required)name: Unique identifier within the Podimage: Container image to runports: Network ports the container exposesresources: CPU and memory requests (minimum needed) and limits (maximum allowed)
Why This Matters
Every time your Deployment scales up or replaces a failed Pod, it uses this exact template. Consistency is guaranteed—all Pods from the same Deployment are identical clones.
Key Takeaway: The pod template specification is the standardized blueprint within a Deployment that defines containers, images, ports, and resource requirements—ensuring every Pod replica is identical and predictable.