mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
60 lines
2.1 KiB
Plaintext
60 lines
2.1 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * applications/deployments/deployment-strategies.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="deployments-creating-rolling-deployment_{context}"]
|
|
= Creating a rolling deployment
|
|
|
|
Rolling deployments are the default type in {product-title}. You can create a rolling deployment using the CLI.
|
|
|
|
.Procedure
|
|
|
|
. Create an application based on the example deployment images found in link:https://quay.io/repository/openshifttest/deployment-example[Quay.io]:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc new-app quay.io/openshifttest/deployment-example:latest
|
|
----
|
|
+
|
|
[NOTE]
|
|
====
|
|
This image does not expose any ports. If you want to expose your applications over an external LoadBalancer service or enable access to the application over the public internet, create a service by using the `oc expose dc/deployment-example --port=<port>` command after completing this procedure.
|
|
====
|
|
|
|
. If you have the router installed, make the application available via a route or use the service IP directly.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc expose svc/deployment-example
|
|
----
|
|
|
|
. Browse to the application at `deployment-example.<project>.<router_domain>` to verify you see the `v1` image.
|
|
|
|
. Scale the `DeploymentConfig` object up to three replicas:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc scale dc/deployment-example --replicas=3
|
|
----
|
|
|
|
. Trigger a new deployment automatically by tagging a new version of the example as the `latest` tag:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc tag deployment-example:v2 deployment-example:latest
|
|
----
|
|
|
|
. In your browser, refresh the page until you see the `v2` image.
|
|
|
|
. When using the CLI, the following command shows how many pods are on version 1 and how many are on version 2. In the web console, the pods are progressively added to v2 and removed from v1:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc describe dc deployment-example
|
|
----
|
|
|
|
During the deployment process, the new replication controller is incrementally scaled up. After the new pods are marked as `ready` (by passing their readiness check), the deployment process continues.
|
|
|
|
If the pods do not become ready, the process aborts, and the deployment rolls back to its previous version.
|