3.4. Deploying the front-end application
Deploy the front-end application that provides the external-facing web component for the tutorial.
The simplest way to deploy an application in OpenShift Container Platform is to run a provided container image.
The following procedure deploys parksmap, which is the front-end component of the national-parks-app application. The web application displays an interactive map of the locations of national parks across the world.
Prerequisites
- You have access to an OpenShift Container Platform cluster.
-
You have installed the OpenShift CLI (
oc).
Procedure
Deploy the
parksmapapplication by running the following command:$ oc new-app quay.io/openshiftroadshow/parksmap:latest --name=parksmap -l 'app=national-parks-app,component=parksmap,role=frontend,app.kubernetes.io/part-of=national-parks-app'Example output
--> Found container image 0c2f55f (4 years old) from quay.io for "quay.io/openshiftroadshow/parksmap:latest" * An image stream tag will be created as "parksmap:latest" that will track this image --> Creating resources with label app=national-parks-app,app.kubernetes.io/part-of=national-parks-app,component=parksmap,role=frontend ... imagestream.image.openshift.io "parksmap" created deployment.apps "parksmap" created service "parksmap" created --> Success Application is not exposed. You can expose services to the outside world by executing one or more of the commands below: 'oc expose service/parksmap' Run 'oc status' to view your app.
3.4.1. Exposing the front-end service 링크 복사링크가 클립보드에 복사되었습니다!
By default, services running on OpenShift Container Platform are not accessible externally. To expose your service so that external clients can access it, you can create a route.
A Route object is a OpenShift Container Platform networking resource similar to a Kubernetes Ingress object. The default OpenShift Container Platform router (HAProxy) uses the HTTP header of the incoming request to determine where to proxy the connection.
Optionally, you can define security, such as TLS, for the route.
Prerequisites
-
You have deployed the
parksmapfront-end application. -
You have
cluster-adminor project-leveladminprivileges.
Procedure
Create a route to expose the
parksmapfront-end application by running the following command:$ oc create route edge parksmap --service=parksmap
Verification
Verify that the application route was successfully created by running the following command:
$ oc get route parksmapExample output
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD parksmap parksmap-user-getting-started.apps.cluster.example.com parksmap 8080-tcp edge None