Reputation: 4168
I'm new to Kubernetes and trying to point all requests to the domain to another local service.
Both applications are running in the same cluster under a different namespace
Example domains
a.domain.com
hosting first app
b.domain.com
hosting the second app
When I do a curl
request from the first app to the second app (b.domain.com
). it travels through the internet to the second app.
Usually what I could do is in /etc/hosts
point b.domain.com
to localhost.
What do we do in this case in Kubernetes?
I was looking into Network Policies but I'm not sure if it correct approach.
Also As I understood we could just call service name.namespace:port
from the first app. But I would like to keep the full URL.
Let me know if you need more details to help me solve this.
Upvotes: 1
Views: 1095
Reputation: 1691
The way to do it is by using the Kubernetes Gateway API. Now, it is true that you can deploy your own implementation since this is an Open Source project, but there are a lot of solutions already using it and it would be much easier to learn how to implement those instead.
For what you want, Istio would fit your needs. If your cluster is hosted in a Cloud environment, you can take a look at Anthos, which is the managed version of Istio.
Finally, take a look at the blog Welcome to the service mesh era, since the traffic management between services is one of the elements of the service mesh paradigm, among others like monitoring, logging, etc.
Upvotes: 1