Paulo Merson
Paulo Merson

Reputation: 14525

How do you create a deployment configuration in OpenShift? Is it automatic for new-app based on a docker image?

I'm creating a new-app based on an image stream that corresponds to a docker image in a private OpenShift docker registry. The command is:

oc new-app mynamespace/my-image:latest -n=my-project

Question 1: Does this command automatically create a deployment configuration (dc) that can be referrenced as dc/my-image? Is this deployment configuration associated with my-project?

Question 2: What is the oc command to create a deployment configuration? The OpenShift developer guide has a section titled Creating a Deployment Configuration, but surprisingly it does not say how to create a DC or give any examples. It just shows a JSON structure and says DCs can be managed with the oc command.

Upvotes: 2

Views: 5707

Answers (1)

akostadinov
akostadinov

Reputation: 18624

Yes, your command will create stuff in the specified project. You can check what objects are created using the oc get command. i.e. to check what DCs you have, you'd do oc get dc or oc get deploymentconfigs.

Other useful commands are oc describe - similar to get but more information. oc status -v - see more broad information about project including warnings and errors.

You create DC and any other resource types using the oc create command. e.g. you copy the example DC off the URL you link to and put it into a file. Finally you do oc create -f mydc.yaml. Both YAML and JSON are supported.

As you see some commands can create DCs by themselves without you providing them with YAML or JSON. You can later modify existing resources with oc edit service/my-app. There is the oc patch command suitable for scripting.

You can see existing resource YAML doing oc get dc/myds -o yaml. Same with any other resource. Keep in mind you are presently using the desired project or use the -n option as you are doing in your example.

Not that hard once you understand some basics and learn to use the oc describe and oc logs command to debug issues with your images/pods. e.g. oc describe pod/my-app-1-asdfg, oc logs my-app-1-asdfg, oc logs -f dc/my-app.

HTH

Upvotes: 3

Related Questions