Rollback restores a deployed application to a previously functioning version when a newer release causes problems. Kubernetes Deployments support rollback alongside gradual rolling updates, limiting user impact during failed upgrades. section 3.3.3
Use rollback as part of a controlled Deployment update:
- Change the container image tag, such as from v1 to v2, and apply the updated Deployment manifest. section 3.3.3
- Inspect rollout events and Deployment status to identify scaling activity and whether the intended version is available. section 3.3.3
- Run kubectl rollout undo deployment/joker-deployment to return to the previous functioning version. section 3.3.3
Rolling back a failed image update
A three-replica Deployment initially runs hello-joker:v1. Updating the manifest to hello-joker:v2 causes Kubernetes to scale ReplicaSets gradually. If the new version misbehaves, kubectl rollout undo deployment/joker-deployment restores the earlier version; Deployment status then reports all three replicas ready, up to date, and available. section 3.3.3
Listing 3.6 deployment.yaml: creating a deployment
apiVersion: apps/v1 #1
kind: Deployment #2
metadata:
name: joker-deployment #3
labels:
app: fast-api
spec:
template: #4
metadata:
name: joker
labels:
app: fast-api
spec:
containers:
- name: hello-joker
image: varunmallya/hello-joker:v1
ports:
- containerPort: 8083
replicas: 3
selector:
matchLabels:
app: fast-api
Inspect the Deployment manifest that defines the replica count, pod template, container image, and selector used by the rollback example. section 3.3.3







