Kubernetes Deployment Strategy: Recreate¶
Recreate is a deployment strategy available in Kubernetes as a native option within the Deployment resource object^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
Mechanism¶
The strategy is defined by setting spec.strategy.type to Recreate^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]. When a deployment update is triggered using this strategy, Kubernetes terminates all currently running instances of the application (Pods) before creating new ones^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]. Only after the previous version is completely shut down does the system start the new version^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
This results in a period of downtime where the service is unavailable, as the old Pods are terminated and the new Pods are initialized^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]. The total duration of this downtime depends on the time required for the application to shut down and start up^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
Usage¶
It is one of the two built-in strategies for replacing Pods in a Deployment, alongside Rolling Update^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]. While it is considered one of the easiest strategies to implement due to its simple configuration, it is generally not recommended for use in production environments or development environments where high availability is required because of the inevitable service interruption^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
Related Concepts¶
- [[Kubernetes Deployment Strategy: Rolling Update]]
- [[Downtime]]
Sources¶
^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]