Best approach to communicate between services under ingress controller

7/2/2020

Currently I have setup an nginx ingress controller routing to my two services. Say /api and /app.
(https://docs.microsoft.com/en-us/azure/aks/ingress-tls)

What would be the best approach to communicate between /api and /app?
/api is running on port 80, and /app is running port 3000.

My Nginx ingress controller is the only service with an external IP of course. And the services have their own cluster IP, so how should one go about communicating between services here?


Edit: Because my services are in Go I will solve it programmatically. Thanks for your suggestions though :)

-- asisleep
kubernetes
nginx-ingress

2 Answers

7/2/2020

Use clusterIP type kubernetes service (operating at L4 layer) for east-west traffic between applications deployed in the same kubernetes cluster. Ingress(operating at L7 layer) is generally recommended for north south incoming traffic originated from outside the kubernetes cluster.

-- Arghya Sadhu
Source: StackOverflow

7/2/2020

you can query your services like this:

your-namespace.your-service.cluster.local

the kubernetes cluster DNS will resolve and traffic will be routed internally

-- Rémi F
Source: StackOverflow