kubernetes deployment
kubernetes pod update strategies
ReplicaSet FTW
- update template
- delete legacy kubernetes pods
- wait
Drawback
Service interruption while the kubernetes ReplicaSet creates the kubernetes pods with the new template.
ReplicaSet + kubernetes service
- create a new kubernetes ReplicaSet dedicated to the new version
- when all kubernetes pods are
READ
, change the selector in the kubernetes service - delete the old kubernetes ReplicaSet
Drawback
Needs to have both versions at a time, hence twice the resource consumption.
Manual rolling update
Drawback
Lots of manual operations, hence error prone.
Deployment
Enter Deployment
:
Controlling the “Rollout”
maxSurge
(default 25%): how many kubernetes pod instances greater than targeted replicas is allowed- e.g. for
nb_replicas=4
, there won’t be more than5
kubernetes pods inREADY
- e.g. for
maxUnavailable
(default 25%): how many kubernetes pod instances can be unavailable than targeted replicas is allowed- e.g. for
nb_replicas=4
, there won’t be less than3
kubernetes pods inREADY
- e.g. for
Example 1: replicas=3, maxSurge=1, maxUnavailable=1
Example 2: replicas=3, maxSurge=1, maxUnavailable=0
Re-creation strategy
If you can’t have both versions at the same time, there is another strategy: Recreate
- delete existing kubernetes pods
- create new kubernetes pods
There is a service interruption!