Lincoln's Notes

Step-by-Step Guide to Deploy Java Applications to Redhat Openshift(Kubernetes)

1. Register for a RedHat Developer Sandbox

2. Login to your RedHat Developer Sandbox oc

3. Install "oc" command line utility (RedHat's version of kubectl)

Instructions are here

4. Test "oc" command line utility

oc status oc

5. Copy the "oc login" command from the UI and run it on the console

oc oc oc

6. Clone The Simple Java Application from GitHub

git clone

7. Change into Application Directory

cd first-openshift-java

8. Create an "Image Stream" to refer to your Images

oc create is my-java-image-stream oc

9. Create a "Build Config" to convert your Java Source Code to an Image

oc apply -f manifests/oc_1_bc.yaml oc

10. Start the Build to create an Image

oc start-build build-my-java --from-dir=. --follow oc oc

11. Deploy the Image

export OPENSHIFT_NAMESPACE=$(oc config view --minify -o 'jsonpath={..namespace}') oc process -f manifests/oc_2_dc.yaml -p OPENSHIFT_NAMESPACE=$OPENSHIFT_NAMESPACE |oc create -f - oc

12. Create the Service to access the application from within Openshift

oc apply -f manifests/oc_3_service.yaml oc

13. Create the Route to access the application from the Internet

oc process -f manifests/oc_4_route.yaml -p OPENSHIFT_NAMESPACE=$OPENSHIFT_NAMESPACE |oc create -f - oc

14. Access the Application


Close Bitnami banner