container, devops, docker, Java, openshift, PaaS, Red Hat OpenJDK 8, S2I

Deploy Java SpringBoot artifact to OpenShift Container Platform

What is OpenShift?

OpenShift  is Red Hat’s  platform-as-a-service (PaaS) product, built around a core of application containers powered by Docker, with orchestration and management provided by Kubernetes, on a foundation of Red Hat Enterprise Linux.

Why PaaS?

PaaS automates the hosting, configuration, deployment, and administration of application stacks in an elastic cloud environment. It gives app developers self-service access so they can easily deploy applications on demand.

Getting Started

Sign-up for OpenShift and install the CLI.

Below example shows how to deploy a SpringBoot Java artifact into OpenShift via S2I .

Step 1: If  VPN ( Virtual Private Network ) is needed to access OpenShift log into VPN. Else skip this step

Step 2: Sign into OpenShift url

Step 3Connect to OpenShift CLI. 

Note: If proxy is involved, NO_PROXY must be set in order to connect from OpenShift CLI.  Windows users can set it in .bash_rc and MAC users in ~/.profile

Eg:

export NO_PROXY=openshift-starter-us-west-1.openshift.com

Openshift CLI config file resides in /Users/<user>/.kube/config .

Step 4: Copy Login Command from OpenShift console and paste it in CLI.

Screen Shot 2018-05-23 at 3.04.56 PM

Eg:

oc login https://api.starter.us-west-1.openshift.com –token=bkG0ec5vp1234556778ffss

Step 5:   Create a New Project using the below command

                oc new-project curtis-tech

Step 6: From open shift console , browse catalog and select “Red Hat OpenJDK 8” to build and deploy java from git repository. We are following the S2I ( Source to Image Concept)

Screen Shot 2018-05-23 at 3.17.11 PM

Screen Shot 2018-05-23 at 3.18.20 PM

When you hit the create button, it will trigger a build under Builds->Build

Screen Shot 2018-05-23 at 3.20.22 PM

When the build is successfully complete, check Applications->Pod ( Log tab to see if the springboot application is started )

Step 7: Click on Applications->Route and hit on the url. You will see the below

Screen Shot 2018-05-23 at 3.49.01 PM

Now you have successfully deployed your application on OpenShift!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s