第6章 Configuring routes
You can configure routes for services to have MicroShift node access.
6.1. Creating an HTTP-based route リンクのコピーリンクがクリップボードにコピーされました!
A route allows you to host your application at a public URL. It can either be secure or unsecured, depending on the network security configuration of your application. An HTTP-based route is an unsecured route that uses the basic HTTP routing protocol and exposes a service on an unsecured application port.
The following procedure describes how to create a simple HTTP-based route to a web application, using the hello-microshift application as an example.
Prerequisites
-
You installed the OpenShift CLI (
oc). - You have access to your MicroShift node.
- You have a web application that exposes a port and a TCP endpoint listening for traffic on the port.
Procedure
Create a service called
hello-microshiftby running the following command:$ oc expose pod hello-microshift -n $namespaceCreate an unsecured route to the
hello-microshiftapplication by running the following command:$ oc expose svc/hello-microshift --hostname=microshift.com $namespace
Verification
Verify that the
routeresource was created by running the following command:$ oc get routes -o yaml <name of resource> -n $namespace1 - 1
- In this example, the route is named
hello-microshiftand the namespace is namedhello-microshift.
Sample YAML definition of the created unsecured route:
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: hello-microshift
namespace: hello-microshift
spec:
host: microshift.com
port:
targetPort: 8080
to:
kind: Service
name: hello-microshift