Search code examples
kubernetesazure-container-service

Frontend communication with API in Kubernetes cluster


Inside of a Kubernetes Cluster I am running 1 node with 2 deployments. React front-end and a .NET Core app. I also have a Load Balancer service for the front end app. (All working: I can port-forward to see the backend deployment working.)

Question: I'm trying to get the front end and API to communicate. I know I can do that with an external facing load balancer but is there a way to do that using the clusterIPs and not have an external IP for the back end?

The reason we are interested in this, it simply adds one more layer of security. Keeping the API to vnet only, we are removing one more entry point.

If it helps, we are deploying in Azure with AKS. I know they have some weird deployment things sometimes.


Solution

  • The problem with this configuration is the idea that the Frontend app will be trying to reach out to the API via the internal cluster. But it will not. My app, on the client's browser can not reach services and pods in my Kluster.

    My cluster will need something like nginx or another external Load Balancer to allow my client side api calls to reach my API.

    You can alternatively used your front end app, as your proxy, but that is highly not advised!