title: How to define/use endpoints to connect to Kubernetes from Javascript
body: <p>I have a doubt regarding how to structure my dockerized stack, simplified in two containers to get help here:</p>
  
  <ul>
  <li>static: NGINX serving static resources (JS/HTML).</li>
  <li>rest: express.js backend for the REST Api.</li>
  </ul>
  
  <p>Without Kubernetes, just docker-compose on a node, <em>rest</em> is simply listening on a different port and, from Javascript, the requests go to <em>same_host:rest_port</em>, no problem here.</p>
  
  <p>With Kubernetes, I understand that I need to use the service name from Kubernetes, something like "rest" (to make transparent the service itself), but that name would only be visible from the docker container serving the static resources.</p>
  
  <p>My question: do I need to forward traffic from NGINX to the REST Api? Does Kubernetes expose a public service name usable from Javascript, for example?</p>
  
  <p>Thank you.</p>