<p>We have an application that runs on an Ubuntu VM. This application connects to Azure Redis, Azure Postgres and Azure CosmosDB(mongoDB) services.</p>

<p>I am currently working on moving this application to Azure AKS and intend to access all the above services from the cluster. The services will continue to be external and will not reside inside the cluster.</p>

<p>I am trying to understand how the network/firewall of both the services and aks should be configured so that pods inside the cluster can access the above services or any Azure service in general.</p>

<p>I tried the following:</p>

<ul>
<li>Created a configMap containing the connection params(public ip/address, username/pwd, port, etc) of all the services and used this configMap in the deployment resource. </li>
<li>Hardcoded the connection params of all the services as env vars inside the container image</li>
<li>In the firewall/inbound rules of the services, I added the AKS API ip, individual node ips</li>
</ul>

<p>None of the above worked. Did I miss anything? What else should be configured?</p>

<p>I tested the setup locally on minikube with all the services running on my local machine and it worked fine.</p>

<blockquote>
  <p>I am currently working on moving this application to Azure AKS and
  intend to access all the above services from the cluster.</p>
</blockquote>

<p>I assume that you would like to make all services to access each other and all the services are in AKS cluster? If so, I advise you configure the internal load balancer in AKS cluster.</p>

<blockquote>
  <p>Internal load balancing makes a Kubernetes service accessible to
  applications running in the same virtual network as the Kubernetes
  cluster.</p>
</blockquote>

<p>You can take a try and follow the following document: <a href="https://learn.microsoft.com/en-us/azure/aks/internal-lb" rel="nofollow noreferrer">Use an internal load balancer with Azure Kubernetes Service (AKS)</a>. In the end, good luck to you!</p>
