Course contentsShow
← Cloud and Infrastructure
Lesson 1163 of 2,98923. Kubernetes WorkloadsFree lesson

Pod Template Specification

Define the pod template within a Deployment: containers, images, ports, and resource requirements.

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 Pod
  • image: Container image to run
  • ports: Network ports the container exposes
  • resources: 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.