How do I discover and call services from my applications?

In PodSpace, Service Discovery is achieved by creating Service objects.

For Services in a Project, there are basically two ways of discovering them so that a Pod knows how and which Service to call. There is no need for setting up anything.

Environment Variables

For each Service, a set of environment variables is added to each newly created Pod in that specific Project.

The generated environment variables are compatible with Docker container links.

In this case, Service Discovery implies Pods calling Services, by knowing their IP address from environment variables. Services, in turn, will forward traffic to one of their backend Pods.


For a Service with the name wordpress-master which exposes a TCP port 6379, the generated set of environment variables is:


Any Service that a Pod wants to access must exist before the Pod itself is started. Otherwise, the environment variables associated with that Service will not be defined for the application. If the Service was created when the Pod was already running, the Pod has to be restarted.


The Integrated PodSpace DNS server creates a set of DNS records for each created Service.

Looking for Service IPs in the DNS is an alternative to getting them from the environment variables.

Every project has a domain <project_name>.svc.cluster.local in the Integrated PodSpace DNS Server.

DNS resolutions are set up in every container, so that <project_name>.svc.cluster.local domain is included in their DNS search base.


If a container looks up the hostname mysql in the DNS records, it will resolve the hostname mysql.<project_name>.svc.cluster.local.

Pods can do DNS lookups for Services in external Projects by using their FQDN (fully qualified domain name).

Use the method that suits you better. You can either use DNS based Service Discovery (and refer to the Services as hostnames in your config files) or use environment variable based Service Discovery (and retrieve the Service IP addresses from the environment variables).

How can I publish my apps to the Internet?

All Pods and Services deployed on PodSpace have an internal IP address that is only reachable to other Pods running in the same project.

In order to expose an application to the public, your application has to have a Service defined, and you have to create a Route for that given Service.

In simple terms, a Service is a load balancer that balances traffic to multiple Pods running the same application. The Service has a distinct IP address, which can not be reached from the public Internet. In order for a Service to be exposed to the public, a Route has to be created. A Route simply binds a Service to an external hostname, so that it can receive requests from the public Internet.

To create a Route, open the web console, and go to the Overview page of your project. There is a Create Route link next to each Service which does not have any Routes defined yet.

After clicking on Create Route, you can enter a public hostname for the route, or leave you can leave it empty and PodSpace will generate a hostname with the ending which will be instantly available.

Note that if you want your own domain (like to point to your application, you also have to configure your DNS servers after you have created a Route with the given hostname. All you have to do is to set up your domain so that the and hostnames point to CNAME

For more detailed information, refer to Routes and Pods and Services sections of the OpenShift documentation.