<p>This is the <a href="https://docs.openshift.com/container-platform/3.3/dev_guide/integrating_external_services.html#step-2-consume-a-service" rel="nofollow noreferrer">documentation on External Database Environment Variables</a>. It says,</p>

<blockquote>
  <p>Using an external service in your application is similar to using an internal service. Your application will be assigned environment variables for the service and the additional environment variables with the credentials described in the previous step. For example, a MySQL container receives the following environment variables:</p>
</blockquote>

<pre><code>EXTERNAL_MYSQL_SERVICE_SERVICE_HOST=&lt;ip_address&gt;

EXTERNAL_MYSQL_SERVICE_SERVICE_PORT=&lt;port_number&gt;

MYSQL_USERNAME=&lt;mysql_username&gt;

MYSQL_PASSWORD=&lt;mysql_password&gt;

MYSQL_DATABASE_NAME=&lt;mysql_database&gt;
</code></pre>

<p>This part is not clear - <strong>Your application will be assigned environment variables for the service</strong>. </p>

<p>How should the application be configured so that the <em>environment variables for the service</em> are assigned? I understand that, the ones defined in <code>DeploymentConfig</code> will flow into the application in say NodeJS as <code>process.env.MYSQL_USERNAME</code>, etc. I am not clear, how  <code>EXTERNAL_MYSQL_SERVICE_SERVICE_HOST</code> or <code>EXTERNAL_MYSQL_SERVICE_SERVICE_PORT</code> will flow into.</p>

<p>From <code>Step 1</code> of the link that you posted, if you create a Service object</p>

<pre><code>oc expose deploymentconfig/&lt;name&gt;
</code></pre>

<p>This will automatically generate environment variables (<a href="https://docs.openshift.com/container-platform/3.11/dev_guide/environment_variables.html#automatically-added-environment-variables" rel="nofollow noreferrer">https://docs.openshift.com/container-platform/3.11/dev_guide/environment_variables.html#automatically-added-environment-variables</a>) for all pods in your namespace. (The environment variables may not be immediately available if the Service was added <em>after</em> your pods were already created...delete the pods to have them added on restart)</p>
