For local development I have a working minikube. There we have different services deployed. Now I want to connect the Frontend with the Backend.
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.
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?
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?
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.
Edit(1): The backend service
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
Edit(2): I also get this response when I request from the client with a fqn:
OPTIONS http://backend.default.svc.cluster.local:3000/signup/ net::ERR_NAME_NOT_RESOLVED