Lesson 1 · Unit 04
Rolling updates
maxSurge and maxUnavailable as arithmetic, then watching and undoing a rollout.
What you practise
- A rolling update with
maxSurgeandmaxUnavailableworked as arithmetic, watching it, undoing it
Try a question from this lesson
Pick one
Four Pods of version 1 serve all traffic. You must move to version 2 with no downtime, and the nodes have room for only one extra Pod. Which plan works?
Hint
Check each plan against both limits: never fewer than four ready, never more than five in total.
Correct answer
Start one new Pod, wait until ready, remove one old; repeat
Why
Deleting first leaves nothing serving. Starting four first needs room for eight. Swapping one at a time keeps four ready and never more than five in existence. A Deployment does exactly this, and calls it a rolling update.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Rolling update: two knobs
Change the Pod template, and the Deployment creates a new ReplicaSet. It scales the new one up and the old one down in steps.
maxSurge: how many Pods above replicas may exist during the update. maxUnavailable: how many below replicas may be missing.
Each is a number or a percentage of replicas, 25% by default. A percentage that is not whole is rounded up for surge and down for unavailable. They cannot both be 0.
spec:
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0Concept
Watching and undoing
A rollout is a process you can watch. rollout status waits and reports progress until every Pod is updated and ready.
Each change of the template is a revision, listed by rollout history. The old ReplicaSets are kept at 0 Pods.
rollout undo goes back one revision: the Deployment scales the previous ReplicaSet up again, as another rolling update. Nothing is rebuilt.
kubectl rollout status deployment/web
kubectl rollout history deployment/web
kubectl rollout undo deployment/web9 more exercises in the app
- 2× type the answer
- 3× multiple choice
- 1× true or false
- 1× order the lines
- 1× fill the blanks
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.