Recently, I’ve made a simple application with spring boot backends and an angular frontend. Here is the ‘architecture’:
The goal was to mimic microservices, that’s why I have three backends with different databases. The microservices only check with each other in order to keep data consistent. So if you make a concert and assign it a performerId, it checks if that is a valid one. I have all this in Docker and can run it successfully locally.
Now, I want to deploy this through Kubernetes. I have a Linode set up to achieve this, but there are some difficulties I run into.
In short, I created deployments for all the apps. For the angular I used a loadbalancer to expose it to the outside world, but the microservices and databases only have a clusterIp. Now, the thing is, how do I connect from Angular to the backend apps? I don’t know what URL to use. My services are as follows:
I thought, I could connect to the ClusterIP’s using the service name. So I changed the URL’s in the frontend to look like: http://concert-cluster-ip... But that doesn’t work. So a few questions:
Is it common practice to shield your microservices or would you make the api’s accessible from the outside? Because, obviously, it worked when I made the services loadbalancers and updated the URL’s in the back- and frontend but I think that’s not what you would do?
Is it possible to access the backends with the front end with my current setup? I assume so, because the databases do work like this.
Should I put an Ingress service before the traffic? And should Ingress govern all traffic? So a request to the frontend and requests from the frontend to the backend? Or should I make two ingresses, one for the backends and one for the frontend?
How should my URL’s look inside my backend and frontend applications when calling a service?
I did a lot of Kubernetes tutorials but I struggle to apply that knowledge in this case and can’t get it to work. Any help and tips would be appreciated.