Red Hat OpenShift on IBM Cloud is an extension of the IBM Cloud Kubernetes Service where IBM manages the OpenShift Container Platform for you.
With Red Hat OpenShift on IBM Cloud developers have a fast and secure way to containerize and deploy enterprise workloads in Kubernetes clusters. OpenShift clusters build on Kubernetes container orchestration that offers consistency and flexibility for your development lifecycle operations.
This workshop covers Red Hat OpenShift Version 4.3.
If you are looking for the OpenShift 3.11 version of this workshop: It is a branch/release in this repository and you can still find it here: https://github.com/IBM/openshift-on-ibm-cloud-workshops/tree/OpenShift3.11
Deploying Java Microservices to OpenShift on IBM Cloud
Note: In order to run this workshop, you need an IBM Cloud account. And you need to gain access to a pre-configured OpenShift Cluster on IBM Cloud, your lab instructor will provide information.
This workshop demonstrates how to build a microservice with Java and how to deploy it to OpenShift on the IBM Cloud.
The microservice is kept as simple as possible so that it can be used as a starting point for other microservices. The microservice has been developed with Jakarta EE and Eclipse MicroProfile. It is part of our Cloud Native Starter project which basically consists of 3 microservices:
The web application Web-App (frontend) requests data from Web-API. Web-API retreives a list of articles (title and authors name) from the Articles service, and for every author it retrieves details (Blog URL and Twitter handle) from the Authors service. In this lab we only use the Authors service.
This would be the frontend:
There are various ways to deploy applications to OpenShift. The options have different advantages and disadvantages which are explained in the following labs.
This workshop has 7 labs and should take around 90 minutues to complete.
The first lab describes how to install all required prerequisites. In the easiest case this means accessing the IBM Cloud Shell.
<OPTIONAL> Lab 2 and 3 describe how to develop a microservice with Java EE and Eclipse MicroProfile and are useful if you are interested in coding. </OPTIONAL>
The next four labs show four different ways to deploy applications to OpenShift with their pros and cons in this specific scenario:
|Option||Dockerfile||yaml Files||Java Build||Docker Build|
|Lab 4: Kubernetes-like||required||required||OpenShift||OpenShift|
|Lab 6: Existing Image||not required||not required||N/A||N/A|
|Lab 7: Git Repo||required||not required||OpenShift||OpenShift|
|Lab 8: Source to Image||not required||not required||Desktop||OpenShift|
To continue with the workshop follow these steps:
- » Prerequisites «
- OPTIONAL: Running the Java microservice locally
- OPTIONAL: Understanding the Java implementation
- Deploying to OpenShift via ‘oc’ CLI
- Distributed logging with LogDNA and OpenShift on IBM Cloud
- Deploying existing images to OpenShift
- Deployments of code in GitHub repos
- Source to Image deployments