이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 4. Deploying an existing JWS image
You can use the JWS Operator to facilitate the deployment of an existing image for a web server application that you want to deploy in an OpenShift cluster. In this situation, you must create a custom resource WebServer file for the web server application that you want to deploy. The JWS Operator uses the custom resource WebServer file to handle the application deployment.
Prerequisites
You have installed the JWS Operator from OperatorHub.
To ensure that the JWS Operator is installed, enter the following command:
oc get deployment.apps/jws-operator
$ oc get deployment.apps/jws-operatorCopy to Clipboard Copied! Toggle word wrap Toggle overflow The preceding command displays the name and status details of the Operator.
For example:
NAME READY UP-TO-DATE AVAILABLE AGE jws-operator 1/1 1 1 15h
NAME READY UP-TO-DATE AVAILABLE AGE jws-operator 1/1 1 1 15hCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf you want to view more detailed output, you can use the following command:
oc describe deployment.apps/jws-operator
Procedure
-
Prepare your image and push it to the location where you want to display the image (for example,
quay.io/<USERNAME>/tomcat-demo:latest). To create a custom resource file for your web server application, perform the following steps:
-
Create a YAML file named, for example,
webservers_cr.yaml. Enter details in the following format:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Create a YAML file named, for example,
To deploy your web application, perform the following steps:
- Go to the directory where you have created the web application.
Enter the following command:
oc apply -f webservers_cr.yaml
$ oc apply -f webservers_cr.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow The preceding command displays a message to confirm that the web application is deployed.
For example:
webserver/example-image-webserver created
webserver/example-image-webserver createdCopy to Clipboard Copied! Toggle word wrap Toggle overflow When you run the preceding command, the Operator also creates a route automatically.
Verify the route that the Operator has automatically created:
oc get routes
$ oc get routesCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Delete the
webserverthat you created in Step 3:oc delete webserver example-image-webserver
$ oc delete webserver example-image-webserverCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteAlternatively, you can delete the
webserverby deleting the YAML file. For example:oc delete -f webservers_cr.yaml