Updating an Application in Kubernetes
Updates are handled differently for different resources in Kubernetes. Since deployments are used for stateless applications, they need to be managed differently from StatefulSets, which are used for stateful applications. In this section, we will explore how updates can be handled in StatefulSets and deployments.
StatefulSet Update Strategies
In StatefulSets, an update strategy can be configured using the updateStrategy
field in the resource definition. It can be set to the two following values: OnDelete
and RollingUpdate
.
OnDelete
When the OnDelete
option is used, the Kubernetes controller does not automatically update the StatefulSet's pods. You must first delete the pods in order for the update process to take place. This is particularly useful for performing checks to verify whether the new version works correctly. However, in this way, an update is entirely a manual process that takes a lot of time and cannot be used in...