Container Service: Deploying an Application - Routing non-HTTP Traffic to your Application

Overview

For developers creating web applications and services, OpenShift provides an easy means to route traffic to your application, the route.

But what about applications that use a TCP protocol other than HTTP, HTTPS or TLS, such as SSH? The Container Service provides a means to route traffic to these applications as well. This document provides the steps required to make these applications available outside of the OpenShift cluster. This document presumes that you have a working containerized application that it is already hosted in the Container Service production cluster. The steps required are:

  • Create a route for your application
  • Label your route with the label: router=tcp-router
  • Find the port assigned to your application

Domain and Assigned Ports

Your application will be provided a specific port within the range of 30000-31000, at the following domain: tcp.aws.web.umich.edu. Applications hosted at that domain is available from on-campus networks and the VPN. This port is assigned to your application and should remain static, but there is the possibility that it will change in the future. If your use case involves an external application that accesses this port, it would be advisable to make this port configurable, as opposed to hard-coded.

Create a Route with the Appropriate Label

The OpenShift UI and CLI can both be used to create a route with the appropriate label. Using the UI will necessitate one additional step.

  • Using the UI
    • Create a route using the steps described in the OpenShift Documentation.
    • Label the newly created route using the following command: oc label route my-service router=tcp-router
    • In this example, replace my-service with the name of your service.
  • To create a route using the cli, use the following syntax: oc expose svc/my-service -l router=tcp-router
    • In this example, replace my-service with the name of the service you wish to expose.

Finding Your Assigned Port

Your route will be assigned a port once it has been labeled. Note: the process of assigning a port to your service can take upwards of 30 seconds. If the steps below do not yield a port, please wait and try again after 30 seconds. You can find the port that has been assigned to your service in either the UI or the CLI.

  • Using the UI:
    • In your project, go to: Applications -> Routes, and click on the name of your route. The assigned port is shown in blue underneath the name of the route, as shown below. In this example, the exposed port is 30002
  • Using the CLI: Issue the following command. The 'port' will indicate the port that has been assigned to your service.

$ oc get routes my-service -o custom-columns=port:.metadata.labels.exposed-port
port
30002

 

 

Last Updated: 
Thursday, July 16, 2020