title: Kubernetes - nginx angularjs POD to access nodejs REST API url (another POD) within the cluster dynamically
body: <p>Using Kubernetes -- Gogle Container Enginer setup , Within the Same google cloud Cluster, I am having the Front end Service -> nginx + Angular JS and REST API service --> NodeJS API. I don't want to expose NodeJS API KubeCTL Service public domain. So, 'ServiceType' is set to only 'ClusterIP' . How do we infer this NODE_API_SERIVCE_HOST , NODE_API_SERIVCE_PORT --  {SVCNAME}_SERVICE_HOST and {SVCNAME}_SERVICE_PORT -- inside AngularJS program. </p>
  
  <pre><code> (function() {
  'use strict';
  
  angular
      .module('mymodule', [])
      .config(["RestangularProvider", function(RestangularProvider) {
        var apiDomainHost = process.env.NODE_API_SERVICE_HOST;
        var apiDomainPort = process.env.NODE_API_SERVICE_PORT;
        RestangularProvider.setBaseUrl('https://'+apiDomainHost+':'+apiDomainPort+'/node/api/v1');        }]);
   })();
  </code></pre>
  
  <p>Then this will not work ( ReferenceError: process is not defined ) , as these angularjs code is executed at the client side. </p>
  
  <p>My docker file is simple to inherit the nginx stop / start controls.</p>
  
  <pre><code>FROM nginx
  COPY public/angular-folder /usr/share/nginx/html/projectSubDomainName
  </code></pre>
  
  <p>Page 43 of 62 in <a href="http://www.slideshare.net/carlossg/scaling-docker-with-kubernetes" rel="nofollow">http://www.slideshare.net/carlossg/scaling-docker-with-kubernetes</a>, explains that can we invoke the Command sh </p>
  
  <pre><code> "containers": {
       {
        "name":"container-name",
        "command": {
          "sh" , "sudo nginx Command-line parameters
      'https://$NODE_API_SERVICE_HOST:$NODE_API_SERVICE_PORT/node/api/v1'"
   }
   }
   }
  </code></pre>
  
  <p>Is this sustainable for the PODs restart? IF so, how do I get this variable in AngularJS?</p>