<p>I have an app that is deployed in k8s cluster and the frontend and the backend of the app are exposed, is there a way to not expose the backend ? i thought about the api gateway is it going to fulfills my requests if yes how ? and if not what's the alternatives ??</p>
<p>Thank you in advance</p>
<p>I tried the gateway kong and it did not work out very well</p>

Daham Ahmed
<p>Your question requires more detail for me to be certain, however I will take a stab at pointing you in the right direction.</p>
<p>Typically, most apps have a frontend which serves the HTML, and any static assets such as images, css and javascript (like a single page app such as ReactJS)
If you have some SPA, then you will likely have a backend API written in something like Node / Python / PHP / Java to serve your frontend app with dynamic data.</p>
<p>If your frontend and backend are exposed to the internet, this is OK and expected.</p>
<p>If your backend was not exposed to the internet, then it would be impossible for your frontend to load dynamic data.</p>
<p>That said, you mentioned that you are using or at least tried to use an API Gateway. Typically, you would not expose your backend <em>directly</em> to the internet. Rather, you would expose your API Gateway to the internet, with the API Gateway acting as a reverse proxy to your backend.</p>
<p>In order to achieve this (in Kubernetes), you would typically create a <a href="https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer" rel="nofollow noreferrer">Service type Load Balancer</a> for your API Gateway. And configure a Service type Cluster IP for your backend.</p>
<blockquote>
<p>ClusterIP: Exposes the Service on a cluster-internal IP. Choosing this value makes the Service only reachable from within the cluster. This is the default that is used if you don't explicitly specify a type for a Service. You can expose the service to the public with an Ingress or the Gateway API.</p>
</blockquote>
