In this lab we introduce how to simplify your container deployments w/ OpenShift templates. We will also explore the web console.
This lab should be performed on workstation.example.com unless otherwise instructed.
Expected completion: 20 minutes
We should still be in our "production" project space at this point.
$ oc project
Using project "production" on server "https://atomic-host.example.com:8443".Ensure you're still logged in as the developer user & clean up the resources deployed in chapter 4.
$ oc whoami
developer
$ oc delete all --allEnsure the following command displays "No resources found" before proceeding.
$ oc get all
No resources found.This time, let's simplify things by deploying an application template. We've already included a template w/ lab5 which leverages our wordpress & mariadb images.
$ cd ~/summit-2017-container-lab/labs/lab5/
$ grep -i cdk.example.com wordpress-template.yamlLet's deploy this wordpress template:
# add your template to the production project
$ oc create -f wordpress-template.yaml
template "wordpress" created
# deploy your new template w/ "oc new-app" and note its output
$ oc new-app --template wordpress
--> Deploying template "production/wordpress" to project productionWatch all of the newly created resources until the pods are in "Running" status... ctrl-c to exit
$ watch -n 5 oc get all
NAME READY STATUS RESTARTS AGE
po/mariadb-1-nujmr 1/1 Running 0 2m
po/wordpress-1-pz9fu 1/1 Running 0 2m
# wait for the database to start... ctrl-c when done.
$ oc logs -f dc/mariadb
mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
# wait for wordpress to start... ctrl-c when done.
$ oc logs -f dc/wordpress
/usr/sbin/httpd -D FOREGROUND
# oc status gives a nice view of how these resources connect
$ oc statusCheck and make sure you can access the wordpress service through it's route:
$ curl -L http://wordpress-production.atomic-host.example.com
or
point your browser to the URL to view the GUIOpenShift includes several ready-made templates. Let's take a look at some of them:
$ oc get templates -n openshiftFor more information on templates, reference the official OpenShift documentation:
https://docs.openshift.com/container-platform/latest/dev_guide/templates.html
Now that we have deployed our template, let’s login as developer to the OpenShift web console - https://atomic-host.example.com:8443:

And after we’ve logged in, we see a list of projects that the developer user has access to. Let's select the production project:

Our project landing page provides us with a high-level overview of our wordpress application's pods, services, and route:

Let's dive a little deeper. We want to view a list of our pods by clicking on Pods in the left Applications menu:

Next, let's click on one of our running pods for greater detail:

With this view, we have access to pod information like status, logs, image, volumes, and more:

Feel free to continue exploring the console and thanks for taking the lab!