Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can oc new-app create a Deployment instead of a DeploymentConfig?

Tags:

openshift

oc new-app always creates a DeploymentConfig. Is there an option to create a Deployment instead of a DeploymentConfig?

Why? DeploymentConfig is a proprietary legacy Red Hat only resource kind. I would prefer a modern cross platform industry standard Deployment.

like image 910
Paul Bennett Avatar asked Dec 04 '20 18:12

Paul Bennett


People also ask

What is the difference between DeploymentConfig and deployment?

One important difference between Deployment and DeploymentConfig objects is the properties of the CAP theorem that each design has chosen for the rollout process. DeploymentConfig objects prefer consistency, whereas Deployments objects take availability over consistency.

What does OC new-app create?

The new-app command generates OpenShift Container Platform objects that will build, deploy, and run the application being created. Normally, these objects are created in the current project using names derived from the input source repositories or the input images. However, new-app allows you to modify this behavior.

How do I create an OpenShift deployment?

Creating a Deployment Configuration An image change trigger trigger causes a new replication controller to be created each time a new version of the origin-ruby-sample:latest image stream tag is available. The Rolling strategy is the default way of deploying your pods. May be omitted. Pause a deployment configuration.

How do I deploy OpenShift app?

There are two easy ways to deploy an OpenShift Application. Using Console: You can directly deploy the website using the Graphical User Interface of OpenShift with just a few clicks. Using CLI: OpenShift also provides a Command Line Interface where with few commands, you can deploy an Application.


Video Answer


1 Answers

oc new-app always creates a DeploymentConfig. Is there an option to create a Deployment instead of a DeploymentConfig?

Current versions of oc have been creating Deployments for quite some time now:

$ oc new-app --docker-image=<IMAGE> --name=my-application
--> Found container image [..]

    * An image stream tag will be created as "my-application:latest" that will track this image

--> Creating resources ...
    imagestream.image.openshift.io "my-application" created
    deployment.apps "my-application" created
    service "my-application" created
--> Success
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose service/my-application'
    Run 'oc status' to view your app.
$ oc get deployment
NAME             READY   UP-TO-DATE   AVAILABLE   AGE
my-application   1/1     1            1           7s
$ oc get deploymentconfig
No resources found in simon namespace.

So you should update your oc client as you seem to be using an old version (my output above is with a 4.6 client).

The old behaviour of creating a DeploymentConfig can still be forced by using the --as-deployment-config option:

$ oc new-app --docker-image=<IMAGE> --name=my-application --as-deployment-config

Note that DeploymentConfigs still have their place if you want to use features like triggers, automatic rollback, lifecycle hooks or custom strategies (DeploymentConfigs-specific features)

like image 165
Simon Avatar answered Jan 04 '23 01:01

Simon