<p>I'm new to Kubernetes and trying to point all requests to the domain to another local service.</p>
<p>Both applications are running in the same cluster under a different namespace</p>
<p>Example domains
<code>a.domain.com</code> hosting first app
<code>b.domain.com</code> hosting the second app</p>
<p>When I do a <code>curl</code> request from the first app to the second app (<code>b.domain.com</code>). it travels through the internet to the second app.</p>
<p>Usually what I could do is in <code>/etc/hosts</code> point <code>b.domain.com</code> to localhost.</p>
<p>What do we do in this case in Kubernetes?</p>
<p>I was looking into Network Policies but I'm not sure if it correct approach.</p>
<p>Also As I understood we could just call <code>service name.namespace:port</code> from the first app. But I would like to keep the full URL.</p>
<p>Let me know if you need more details to help me solve this.</p>

SergkeiM
<p>The way to do it is by using the <a href="https://gateway-api.sigs.k8s.io" rel="nofollow noreferrer">Kubernetes Gateway API</a>. 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.</p>
<p>For what you want, <a href="https://istio.io" rel="nofollow noreferrer">Istio</a> would fit your needs. If your cluster is hosted in a Cloud environment, you can take a look at <a href="https://cloud.google.com/anthos" rel="nofollow noreferrer">Anthos</a>, which is the managed version of Istio.</p>
<p>Finally, take a look at the blog <a href="https://cloud.google.com/blog/products/networking/welcome-to-the-service-mesh-era-introducing-a-new-istio-blog-post-series" rel="nofollow noreferrer">Welcome to the service mesh era</a>, since the traffic management between services is one of the elements of the service mesh paradigm, among others like monitoring, logging, etc.</p>
