Kubernetes http query inside cluster

3/6/2020

I am running a Kubernetes Cluster on Azure (AKS), in which a couple of microservices are running based on NodeJS.

I want to query some information from one service by another via HTTP. If I send the query through the internet by the whole domain, the request needs to pass the Loadbalancer (nginx-ingress). But the cluster is protected by an oauth2 proxy.

Is it possible to send the query inside of the cluster?

Example:

request({ url : 'http://service-name/api' }, (err, response, body) => {
        if (err) { throw err; }
        res.json(body);
});
-- Nico Schuck
kubernetes

1 Answer

3/6/2020

https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/

If the services are in the same namespace you can use http://servicename:port

If they are in different namespaces then you can use FQDN http://servicename.namespace.svc.cluster.local:port

-- Tummala Dhanvi
Source: StackOverflow