A Pod template defines the metadata and container specification for Pods created by a workload resource. In a Deployment, it reuses the Pod manifest’s metadata and spec without kind or apiVersion. section 8.3.3
A useful Pod template connects three pieces:
- metadata.labels identifies the Pods and must match the workload’s selector. section 8.3.3
- spec.containers declares the containers, images, ports, environment, and mounts that each Pod receives. section 8.3.3 section 8.4.2
- StatefulSets can extend the template with init containers and containers connected to individually provisioned volumes. section 8.4.2
Listing 8.6 K8s YAML manifest for an NGINX Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 15
selector:
matchLabels:
app: my-nginx
template:
metadata:
labels:
app: my-nginx
spec:
containers:
- name: nginx
image: nginx:latest
This NGINX Deployment shows the template nested under spec, with matching app labels and a container image. section 8.3.3


