Skip to content

Instantly share code, notes, and snippets.

@virtualadrian
Forked from yohanesws/1_JAVA_S2I_OpenShift.md
Created October 23, 2017 15:57
Show Gist options
  • Select an option

  • Save virtualadrian/5ce0ff12e938644f6cd345172c2f1e68 to your computer and use it in GitHub Desktop.

Select an option

Save virtualadrian/5ce0ff12e938644f6cd345172c2f1e68 to your computer and use it in GitHub Desktop.
JAVA S2I OpenShift

Apply JAVA S2I to CDK 2.4

#ssh to CDK
$vagrant ssh

$ oc login 10.1.2.2:8443
#login as admin/admin

#apply Java S2I Template to CDK 2.4
$ oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/ose-v1.3.7/openjdk/openjdk18-web-basic-s2i.json

#import IMAGE
$ oc import-image  -n openshift openshift/redhat-openjdk18-openshift:1.0 --from=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift --confirm
The import completed successfully.

Name:			redhat-openjdk18-openshift
Created:		Less than a second ago
Labels:			<none>
Annotations:		openshift.io/image.dockerRepositoryCheck=2017-05-14T04:56:53Z
Docker Pull Spec:	172.30.248.237:5000/openshift/redhat-openjdk18-openshift

Tag	Spec									Created			PullSpec											Image
1.0	registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:1.0	Less than a second ago	registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift@sha256:bfd6abe4910549...	<same>


Force to synch IMAGE

Sometimes there a moment when CDK not synch the new Image Stream from Above, we need to pull the image first before import

$ docker pull registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift

$ oc import-image  -n openshift openshift/redhat-openjdk18-openshift:1.0 --from=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift --confirm

Using Java S2I

Search JDK Template

JDK S2I

Deploy application using Template

Deploy Application

Follow Build

Follow Build

Access Application

Deployed Application

The Application

[Optional] Deploy hola application using JAVA S2I

Deploy using Template

hola-jdk

add environment variable

This step needed because there issue between Jolokia and Wildfly Swarm that use in hola application. Please wait until build is finished before doing it.

Application --> deployments --> hola-jdk

hola-jkd-environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment