Replace deprecated DeploymentConfigs with deployments

Learn how to convert existing DeploymentConfigs into Kubernetes Deployments in Red Hat OpenShift.

Access the Developer Sandbox

Red Hat OpenShift’s Source-to-Image (S2I) function lets you deploy an application using a DeploymentConfig.

In order to get the full benefit from taking this lesson, you need to:

  • Be familiar with the OpenShift dashboard.

In this lesson, you will:

  • Use the OpenShift dashboard to add an application from source code.
  • Learn how to choose a DeploymentConfig as the resource type.

Use the dashboard to import from GitHub

Once you are logged into your Developer Sandbox for Red Hat OpenShift dashboard, confirm that you are in the Developer perspective (Figure 1).

Developer perspective
Figure 1: Developer perspective.

From the Developer perspective (Figure 2, callout 1), select the +Add option (Figure 2, callout 2)  and the Import from Git card (Figure 2, callout 3):

Importing source code from Git to create an application
Figure 2: Importing source code from Git to create an application.

Use the following value for the Git repo (Figure 3, callout 1):

https://github.com/OpenShiftDemos/web-nodejs.git

OpenShift will attempt to discern the best method for building the application from the supplied source code. In this particular case—and this happens from time to time—the import is not possible as-is. Select the Edit Import Strategy option (Figure 3, callout 2) to explicitly guide the Source-to-Image (S2I) process.

Starting the import process
Figure 3: Starting the import process.

Select the Builder image Import Strategy (Figure 4, callout 1) and the Node.js Builder Image (Figure 4, callout 2).

Specifying the build method and image
Figure 4: Specifying the build method and image.

Select DeploymentConfig as the project type and click Create to build and launch the app (Figure 5).

Creating the DeploymentConfig
Figure 5: Creating the DeploymentConfig.

After a few minutes, your application will be up and running. You can click the Open URL icon (Figure 6) to see the results in your browser (Figure 7).

View the app running as a DeploymentConfig
Figure 6: View the app running as a DeploymentConfig.
App is running, but without a database to supply data
Figure 7: App is running, but without a database to supply data.

Switch to your command line and run the following command to see the results of this lesson:

oc get dc

Here’s an example:

C:> oc get dc
Warning: apps.openshift.io/v1 DeploymentConfig is deprecated in v4.14+, unavailable in v4.10000+
NAME             REVISION   DESIRED   CURRENT   TRIGGERED BY
web-nodejs-git   1          1         1         config,image(web-nodejs-git:latest)

At this point, you have a Node.js front-end application running in your OpenShift sandbox, deployed as a DeploymentConfig. There are no products displayed because you haven’t created and configured a back-end database. Want to do that? Then check out the learning path How to deploy a Java application on Kubernetes in minutes.

Because the DeploymentConfig is deprecated, the next step is to turn this DeploymentConfig into a Deployment.

Previous resource
Overview: Replace deprecated DeploymentConfigs with Deployments
Next resource
Convert a DeploymentConfig into a Deployment