Deploying an App

Return to Workshop

Deploying an App into the Service Mesh

It's time to deploy your microservices application. The application you are working on is a paste board application in which users can post comments in shared boards. Here is a diagram of the architecture:

App Architecture

The microservices include single sign-on (SSO), user interface (UI), the boards application, and the context scraper. In this scenario, you are going to deploy these services and then add a new user profile service.


Create a new project for your application:
PROJECT_NAME=<enter project name>
oc new-project $PROJECT_NAME --display-name="OpenShift Microservices Demo"

You need to add this project to the service mesh. This is called a Member Roll resource. If you do not add the project to the mesh, the microservices will not be added to the service mesh.

Create the member roll resource for your project:
oc apply -f - <<EOF
kind: ServiceMeshMemberRoll
  name: default
  namespace: istio-system

You should already have a local copy of the application code. If you do not, make sure to complete the previous lab.

Navigate to the local repo folder:
cd $HOME/openshift-microservices
Show working tree status:
git status


On branch workshop-stable

Set the project name variable. The project name should have been provided to you by the instructor.

Set the project name variable. For example:

Next we need a local copy of our application code.

Clone the repository in your home directory:
cd $HOME
git clone

Checkout the workshop-stable branch:
cd $HOME/openshift-microservices
git checkout workshop-stable

Deploy Microservices

You are going to build the application images from source code and then deploy the resources in the cluster.

The source files are labeled '{microservice}-fromsource.yaml'. In each file, an annotation '' was added to tell Istio to inject a sidecar proxy.

Navigate to the workshop directory:
cd $HOME/openshift-microservices/deployment/workshop
Verify the annotation in the 'app-ui' file:
cat openshift-configuration/app-ui-fromsource.yaml | grep -B 1


	annotations: "true"

Now let's deploy the microservices.

Deploy the boards service:
oc new-app -f ./openshift-configuration/boards-fromsource.yaml \
  -p APPLICATION_NAME=boards \
  -p GIT_URI= \
  -p GIT_BRANCH=workshop-stable \
  -p DATABASE_SERVICE_NAME=boards-mongodb \
  -p MONGODB_DATABASE=boardsDevelopment
Deploy the context scraper service:
oc new-app -f ./openshift-configuration/context-scraper-fromsource.yaml \
  -p APPLICATION_NAME=context-scraper \
  -p GIT_BRANCH=workshop-stable \
  -p GIT_URI=
Deploy the user interface:
oc new-app -f ./openshift-configuration/app-ui-fromsource.yaml \
  -p APPLICATION_NAME=app-ui \
  -p GIT_BRANCH=workshop-stable \
  -p GIT_URI=
Deploy single sign-on:
oc new-app -f ./openshift-configuration/sso73-x509-https.yaml \
Watch the microservices demo installation:
oc get pods -n $PROJECT_NAME --watch

Wait a couple minutes. You should see the 'app-ui', 'boards', 'context-scraper', and 'sso' pods running. For example:

NAME                       READY   STATUS      RESTARTS   AGE
app-ui-1-build             0/1     Completed   0          64m
app-ui-1-xxxxx             2/2     Running     0          62m
app-ui-1-deploy            0/1     Completed   0          62m
boards-1-xxxxx             2/2     Running     0          62m
boards-1-build             0/1     Completed   0          64m
boards-1-deploy            0/1     Completed   0          62m
boards-mongodb-1-xxxxx     2/2     Running     0          64m
boards-mongodb-1-deploy    0/1     Completed   0          64m
context-scraper-1-build    0/1     Completed   0          64m
context-scraper-1-xxxxx    2/2     Running     0          62m
context-scraper-1-deploy   0/1     Completed   0          62m
sso73-x509-1-xxxxx         2/2     Running     0          62m
sso73-x509-1-deploy        1/1     Completed   0          62m

Each microservices pod runs two containers: the application itself and the Istio proxy.

Print the containers in the 'app-ui' pod:
oc get pods -l app=app-ui -o jsonpath='{.items[*].spec.containers[*].name}{"\n"}'


app-ui istio-proxy

Access Application

The application is deployed! But you need a way to access the application via the user interface.

Istio provides a [Gateway][2] resource, which is a load balancer at the edge of the service mesh that accepts incoming connections. You need to deploy a Gateway resource and configure it to route to the application user interface.

Create the gateway load balancer:
oc process -f ./istio-configuration/ingress-loadbalancer.yaml \
  -p INGRESS_GATEWAY_NAME=demogateway | oc create -f -
Create the gateway configuration and routing rules:
oc process -f ./istio-configuration/ingress-gateway.yaml \
  -p INGRESS_GATEWAY_NAME=demogateway | oc create -f -

To access the application, you need the endpoint of the load balancer you created.

Retrieve the URL of the load balancer:
GATEWAY_URL=$(oc get route istio-demogateway -o jsonpath='{}')
Navigate to this URL in the browser. For example:

You should see the application user interface. Try creating a new board and posting to the shared board.

For example:

Create a new board


Congratulations, you installed the microservices application!

A few key highlights are:

Workshop Details

Domain Red Hat Logo
Student ID

Return to Workshop