<p>I have a question regarding assigning an IP from Azure VNET to nginx-ingress loadbalancer. I am a newbie and hence wanted to check if the approach I am thinking is possible. </p>

<p>We are planning to deploy an <strong>internal</strong> application in Azure Kubernetes. In order to minimise the use of Ips (since our team has a small number of IP addresses allocated through Azure VNET), we have gone for basic networking in AKS and are planning to update the Nginx Loadbalancer with an allocated IP from the Azure VNET. </p>

<p>Will this approach work?  </p>

<p>The confusion I have is the AKS cluster I created uses basic networking, and it has automatically created its own VNET and NSG, however, the ip address allocated to us in the company belongs to a different Azure VNET.  </p>

<p>The constraint I have is that I want to use a minimal number of IP addresses from our allocated IP range. I will be interested on how others are solving this issue.</p>

<p>Help much appreciated.</p>

jack
<p>If you need to use the address space of an existing VNET, you need to select the <em>Advanced</em> network configuration when deploying the resource and select the existing VNET and subnet.</p>

<p>This way, applications will obtain an IP lease from your VNETs built-in DHCP server.</p>

<p>While there may be ways to facilitate routing to the cluster in the way you have deployed, using VNET peering, it makes for an unnecessarily complex architecture.</p>

<p>EDIT:</p>

<p>If you have no option but to deploy AKS to a different network segment because of IP allocation contraints you should still use the Advanced network option but create a new VNET with an address space which does not overlap with the existing VNET.</p>

<p>For example, if your production VNET address space is 10.0.0.0/8, then you must use an address space which fits inside 192.168.0.0/16 or 172.16.0.0/12 - non-overlapping.</p>

<p>Once this is deployed you must creating a peering between the two VNETs.  See <a href="https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-peering-overview" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-peering-overview</a></p>

<p>Once your peering is configured you can create an internal load balancer in the VNET which has the IP contraints and set the backend pool to the AKS load balancer address for your application.</p>

<p><strong>This architecture is merely a workaround for your IP allocation constraints and is not recommended.  There are 16m+ IP addresses available in the 10.0.0.0/8 address space.  If you are constrained to a single IP address in this space then you either have a gigantic environment or your VNET setup is not optimal or accomodating</strong></p>
