Container: Deploying An Application - Exposing Apps as IP Addresses Instead of URLs

Services can be exposed to external load balancers--allowing for failover to external hosting--by exposing the service as a 'load balancer' within OpenShift. The following command illustrates how to do this

oc expose dc myweb --type=LoadBalancer --name=myweb-ingress

In this case, the deployment configuration name is 'myweb'. The name of additional service is 'myweb-ingress'. This should not conflict with existing service names within your project.

Doing this will result in your service being available as a port on the OpenShift nodes:

$ oc get svc

  • Name: myweb-ingress
  • Cluster-IP:172.30.125.250
  • External-IP: 172.29.10.42
  • Port(s): 443:32110/TCP
  • Age: 4m

In this case, the service will be available on port 32110 on all nodes in the cluster.

 

Last Updated: 
Thursday, September 13, 2018