Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (57 sloc) 3.32 KB

Reactive Java Microservices on OpenShift 4

This documentation has been developed/tested on CRC (CodeReady Containers).

1. Create an OpenShift 4 cluster

Start with these 2 documents to create and get access to an OpenShift 4 environment, but make sure to come back here!

  1. Get access to an OpenShift cluster Note: Don't continue with the Istio installation, Istio is currently not required! Continue here:
  2. Requirements for Cloud Native Starter on OpenShift Note: Don't follow the "Continue ..." link at the end of this document, instead return here and continue with the next section!

2. Install Prerequisites

The following script will inform about missing tools:

$ cd ${ROOT_FOLDER}/reactive
$ ROOT_FOLDER=$(pwd)
$ sh os4-scripts/

3. Install Kafka

We will install Kafka via a script using the Strimzi operator:

$ sh os4-scripts/

This script will

  1. Create a project kafka in OpenShift
  2. Install the "strimzi-cluster-operator"
  3. Deploy the "my-cluster-entity-operator"
  4. Deploy Kafka (3 pods my-cluster-zookeeper, 3 pods my-cluster-kafka)

4. Install PostgreSQL

We will install PostgreSQL using the Dev2Devs operator in the OpenShift Web Console

  1. Login to/open the OpenShift Web Console (crc console).
  2. In the 'Administrator' view, in 'Home' -> 'Projects' create a new project 'postgres'.
  3. In the 'Administrator' view, in 'Operators' -> 'OperatorHub' filter for 'postgres'. Note: If you don't see the 'Operator' menu, refresh your browser.
  4. Click on 'PostgreSQL Operator by', continue on the 'Show Community Operator' dialog, then click 'Install'.
  5. 'Installation Mode' is 'A specific namespace on the cluster', namespace is the 'postgres' project. All else should remain default. Click 'Subscribe'.
  6. In the 'Installed Operators' view in project 'postgres' wait until the status of the 'PostgreSQL Operator by' shows a green checkmark and 'InstallSucceeded'.
  7. Click on the operator name, then click 'Create Instance' for the 'Database Database' API.
  8. In the YAML file change '' from 'database' to 'database-articles'. Make sure 'metadata.namespace' is 'postgres'. Click 'Create'.
  9. Go to 'Administrator' view, 'Workloads' -> 'Pods' and check that you see two Running pods, one for database and one for the operator.

5. Deploy and run the sample

$ sh os4-scripts/
$ sh os4-scripts/
$ sh os4-scripts/
$ sh os4-scripts/
$ sh os4-scripts/

To see an example, open the web-app service in your browser. Then create a new article, either with the API explorer of the articles-reactive service or the respective curl command. (See the output of '' for the URL and the curl sample.) Every time you create a new article, the articles list of the web app will automatically show the newest 5 articles.


To delete the project including Kafka and Postgres from OpenShift, run:

$ sh os4-scripts/
You can’t perform that action at this time.