Mr.Gomer
Mr.Gomer

Reputation: 649

Calls between 2 APIs on the same Kubernetes cluster

I have two Api's on the same cluster and when I run the get services I get the following.

dh-service       ClusterIP   10.233.48.45    <none>        15012/TCP           70d
api-service      ClusterIP   10.233.54.208   <none>        15012/TCP      

Now I want to make a Api call from one API to the other, When I do it using the Ingress address for the two Images I get 404 Not Found.

What address should I use for my post calls? Will the cluster ip work ?

Upvotes: 0

Views: 1627

Answers (1)

Jonas
Jonas

Reputation: 129065

I want to make a Api call from one API to the other

If they are in the same namespace and you use http, you can use:

http://dh-service
http://api-service

to access them.

If e.g. the api-service is located in a different namespace e.g. blue-namespace you can access it with:

http://api-service.blue-namespace

See more on DNS for Services and Pods

Upvotes: 5

Related Questions