title: Kubernetes Communication between Frontend and Backend
body: <p>For local development I have a working minikube. There we have different services deployed. Now I want to connect the Frontend with the Backend.</p>
  
  <p>The Frontend is a angular application and lives in its own service.
  The Backend is a node.js application also using a separate service and uses DNS to connect to other internal services like mongodb. </p>
  
  <p>Now I want to communicate from the Frontend with the Backend. DNS is not working because the Frontend does not know how to resolve the named route. The problem is to tell the frontend which backend URL and port it should use to send requests to?</p>
  
  <p>The only working state was approached when I first started the Backend service with type NodePort and copied the url and port to the Frontends target URL. I think this is very unclean to me. Is there another approach to get the url for backend requests into the Frontend?</p>
  
  <p>I know when we deploy a service on a production system with type="LoadBalancer" that the service is exposed by an external IP and I can access the service then from there. And that the external IP will be permanent at pod updates and so on. The problem I also see is that the backend IP needs to be injected into the docker container by an additional commit.</p>
  
  <p>Edit(1): The backend service</p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: backend
    labels:
      app: some-app
      tier: backend
  spec:
    type: NodePort
    ports:
    - port: 3000
    selector:
      app: some-app
      tier: backend
  </code></pre>
  
  <p>Edit(2): I also get this response when I request from the client with a fqn:</p>
  
  <pre><code>OPTIONS http://backend.default.svc.cluster.local:3000/signup/ net::ERR_NAME_NOT_RESOLVED
  </code></pre>