You almost never create Pods directly. You create a Deployment, and the Deployment creates and manages Pods for you. A Deployment is the standard way to run applications in Kubernetes.
You tell the Deployment: "I want 3 replicas of my-app running"
Deployment creates:
Pod 1 (my-app) running
Pod 2 (my-app) running
Pod 3 (my-app) running
Pod 2 crashes:
Deployment notices: "I have 2, I need 3"
Deployment creates Pod 4 automatically
You never had to do anything
A Deployment manages a ReplicaSet, which manages the actual Pods. You work with Deployments — the ReplicaSet is mostly managed automatically.
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3 # how many pods to run
selector:
matchLabels:
app: my-app # which pods this deployment manages
template: # pod template — what each pod looks like
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: nginx:1.25
ports:
- containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
kubectl apply -f deployment.yaml # create or update deployment
kubectl get deployments # list deployments
kubectl get pods # see the 3 pods it created
kubectl describe deployment my-app # detailed status
# Scale
kubectl scale deployment my-app --replicas=5 # scale to 5 pods
kubectl scale deployment my-app --replicas=1 # scale down to 1
# Update image (triggers rolling update)
kubectl set image deployment/my-app my-app=nginx:1.26
# Delete
kubectl delete deployment my-app
When you update a Deployment (new image, new config), Kubernetes does a rolling update by default — it replaces Pods one at a time so your application stays available throughout.
Rolling Update (replicas: 3):
Step 1: Create Pod 4 (new version)
Pod 1 (v1) running
Pod 2 (v1) running
Pod 3 (v1) running
Pod 4 (v2) starting...
Step 2: Pod 4 ready, delete Pod 1
Pod 2 (v1) running
Pod 3 (v1) running
Pod 4 (v2) running
Pod 5 (v2) starting...
Step 3: Pod 5 ready, delete Pod 2
...and so on until all pods are v2
Zero downtime throughout the process.
kubectl rollout status deployment/my-app # watch the rollout progress
kubectl rollout history deployment/my-app # see rollout history
kubectl rollout undo deployment/my-app # rollback to previous version
kubectl rollout undo deployment/my-app --to-revision=2 # rollback to specific version