

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: The Control Plane
incomplete
2: Labels
incomplete
3: Dry Run
incomplete
4: Kubectl Explain
incomplete
5: Rollouts
incomplete
6: Rollbacks
incomplete
7: API Deployment
incomplete
8: Thrashing Pods
incomplete
This lesson's interactive features are locked, please to keep using them
When a rolling update replaces the old ReplicaSet, it gets scaled down to 0 and can be kept around, along with its pod template. By default, Kubernetes retains 10 old ReplicaSets. The deployment's spec.revisionHistoryLimit controls how many to keep; any ReplicaSets beyond that limit are eventually deleted, starting with the oldest.
But in general, when a deploy goes bad, you don't need to figure out what the old config was. You can just roll back with kubectl rollout undo:
kubectl rollout undo deployment synergychat-webThis scales the previous revision's ReplicaSet back up and the current one down, just like a normal rolling update. To go back further than one revision, find the one you want in the history and pass --to-revision:
kubectl rollout history deployment synergychat-web
kubectl rollout undo deployment synergychat-web --to-revision=2rollout undo changes the deployment in the cluster, not the YAML file in your repo. If your file still has the bad config, your next kubectl apply will just break it all again.
One of the most common causes of a bad deploy is a bad container image. When Kubernetes can't download an image, the pod gets stuck before its container ever starts:
ErrImagePull: The last attempt to pull the image failed.
ImagePullBackOff: Kubernetes is waiting a bit before trying again, and the wait gets longer each time.
The usual culprits are a typo in the image name, a tag that doesn't exist, or a private container registry that the cluster doesn't have credentials for. kubectl describe pod will tell you which: look for the Failed events at the bottom.
A coworker deployed a new version of the SynergyChat website straight from their laptop, and now the new pods won't start. The good news is that the rolling update is stuck, so the old pods are still serving traffic.
Roll back the bad deploy.
Submit the shell checks.