mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 15:46:57 +01:00
53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * applications/deployments/deployment-strategies.adoc
|
|
|
|
[id="deployments-recreate-strategy_{context}"]
|
|
= Recreate strategy
|
|
|
|
The Recreate strategy has basic rollout behavior and supports lifecycle hooks
|
|
for injecting code into the deployment process.
|
|
|
|
.Example Recreate strategy definition
|
|
[source,yaml]
|
|
----
|
|
strategy:
|
|
type: Recreate
|
|
recreateParams: <1>
|
|
pre: {} <2>
|
|
mid: {}
|
|
post: {}
|
|
----
|
|
|
|
<1> `recreateParams` are optional.
|
|
<2> `pre`, `mid`, and `post` are lifecycle hooks.
|
|
|
|
The Recreate strategy:
|
|
|
|
. Executes any `pre` lifecycle hook.
|
|
. Scales down the previous deployment to zero.
|
|
. Executes any `mid` lifecycle hook.
|
|
. Scales up the new deployment.
|
|
. Executes any `post` lifecycle hook.
|
|
|
|
[IMPORTANT]
|
|
====
|
|
During scale up, if the replica count of the deployment is greater than one, the
|
|
first replica of the deployment will be validated for readiness before fully
|
|
scaling up the deployment. If the validation of the first replica fails, the
|
|
deployment will be considered a failure.
|
|
====
|
|
|
|
*When to use a Recreate deployment:*
|
|
|
|
- When you must run migrations or other data transformations before your new code
|
|
starts.
|
|
- When you do not support having new and old versions of your application code
|
|
running at the same time.
|
|
- When you want to use a RWO volume, which is not supported being shared between
|
|
multiple replicas.
|
|
|
|
A Recreate deployment incurs downtime because, for a brief period, no instances
|
|
of your application are running. However, your old code and new code do not run
|
|
at the same time.
|