How Rolling Updates Work
Rolling update process on Kubernetes.
- Kubernetes handles rolling updates through ReplicaSets. These manage groups of identical pods, which are units running containerized application instances.
- Let’s look at a simple example:Say a website has 6 pod replicas behind a load balancer. This ReplicaSet runs containers from version 1.0 of the website software.
- Kubernetes then starts the update by creating a parallel ReplicaSet definition for version 2.0, while keeping the old 1.0 one.
- The update begins by spinning up 1 new pod on version 2.0. Traffic still goes mainly to the 6 pods on 1.0. Kubernetes checks that main metrics for the new pod look normal before continuing. The rolling update then creates another 2.0 pod, ramping up to 2 out of 7 pods now on the new version. At the same time, Kubernetes scales down the 1.0 ReplicaSet by destroying one of its pods in parallel.
- This gradual ramp-up of new pods while winding down old ones proceeds slowly. Kubernetes adds health checks on response times, error rates, and resource usage of all pods during this. If metrics degrade, it pauses the update process automatically.
- Eventually version 2.0 pods take over, while removing the last few 1.0 ones. The whole transition gets done with no downtime for users in the best case.
Kubernetes allows controlling the pace and safety checks for this through parameters:
- Max Unavailable – The maximum number of pods OK to take offline during the update, e.g. 1.
- Max Surge – How many extra pods to create temporarily above the original number during the transition.
- Health checks – Custom metrics thresholds to track and metrics services to query if metrics degrade.
With all this power and flexibility, updates can roll out steadily at an organization’s preferred pace. And if things go sideways…just rollback!
Rolling Updates and Rollbacks in Kubernetes: Managing Application Updates
Many websites and apps now run on clusters of computers called containers. Containers let apps run smoothly as groups work on updating and improving the software behind the apps. A system called Kubernetes helps manage and update all those containerized apps. Sometimes app updates go wrong or cause problems for users. Kubernetes has clever ways to update apps that avoid issues.
The main method is called a rolling update. This slowly switches the software behind the scenes from an old version to a new one. A few containers at a time are updated to the new software. Kubernetes checks that each small batch works fine before updating more. This means no downtime for users! Another useful capability is rollbacks. If a new software version causes glitches, Kubernetes can automatically revert to the previous stable version. There is no need for websites to crash or stay broken!