How to make frontend application talk to backend applications without creating ingress for the backend

2/11/2019

I have deployed a kubernetes cluster using kops. The current cluster uses an nginx ingress controller which creates a classic load balancer in AWS. I have some backend applications that talk to the frontend application and some backend services that just talk to each other. The problem is that that the only way currently to make the frontend app talk to the backend apps is by creating an ingress for the backend apps since the frontend sends requests via the domain name since it doesn't understand the internal service names. For backends, it is fine since they can talk internally just by using the service name and their respective port. How can I achieve this without having to create ingress for backends. Is it possible to do that using an Application load balancer or do I need to have an API gateway for that? How do I achieve this architecture? Adding an architecture diagram to show what I want to achieve. Any help is appreciated.enter image description here

-- Anshul Tripathi
amazon-web-services
api-gateway
kops
kubernetes
kubernetes-ingress

2 Answers

2/12/2019

You dont need ingress to connect backend from frontend. assuming both backend and frontend pods are running in the same kubernetes cluster. frontend service can connect backend service using service dns

backend-service.<namespace>.svc.cluster.local
-- P Ekambaram
Source: StackOverflow

2/12/2019

From your "architecture diagramm" it looks like all your applications are within the cluster. So no need for ingress. You can just use kubernetes services.

Your frontend app should be able to call the endpoints of the backend services otherwise you made something wrong in the configuration of the frontend service.

If you have no chance to change the URL which the frontend app calls for backend services, you can use for example a kubernetes service with CNAME and redirect to your internal services.

-- LeonG
Source: StackOverflow