Azure AKS vnet to another vnet communication - azure

We have managed AKS Cluster and it has a few applications PODS. In the same subscription, we have a few servers in the different Resource Group and different VNET. We have a requirement to happen a communication between these two VNET's. I have configured vnet peering between two VNET's but we can see that the communication is not happening.
When I add a rule like "Allow port 443 from all networks" on to the NSG of Virtual machines then everything works fine.
Troubleshooting steps are done.
VNET Peering
Got an API Server IP Address from the "kubeconfig" file and added in the NSG of VM's in a diff RG.
But did not resolve an issue. Could you please help me to fix the issue.

AKS Resources are behind the Internal Load Balancer, so peering did not help. I had to use the Public IP Address provisioned during the AKS Creation process in the NSG. After adding PIP(Available in MC_rg-*** resource group) everything started working.

I would suggest to try connecting the VNET's through VPN gateways .
From an Azure virtual network, connecting to another virtual network is essentially the same as connecting to an on premises network via site-to-site (S2S) VPN.
You will need to go through the below listed steps :
Create VNetA and VNetB and the Corresponding Local Networks.
Create the Dynamic Routing VPN Gateways for each virtual network.
Connect the VPN Gateways.
Please find the referred document for implementing the same solution I have mentioned above .
For more information on difference of vnet peering and vnet gateway you can refer this document.

Related

App Services in peered Azure vnet not working

In my Azure subscription I have 2 peered VNETs. VNET1 has address space 10.16.0.0/16 and VNET2 has 10.250.21.0/24. I have chosen the space addresses so that they were completely different. Peering works given that a VM in VNET1 can ping a VM in VNET2.
However, from VNET 1 I can't access an App Service deployed in VNET2. I tried to access the App Service using the IP address and the private DNS name.
Network Security Groups in both VNETs seem to be fine. I'm able to change them so that basic network diagnostics work (for instance, ping).
Any suggestions please?
EDIT 1 + SOLUTION
I can say that it's solved. After peering the virtual networks, I had to "link the private DNS zones". I had a few issues with the address spaces, but nothing that a terraform destroy/apply couldn't solve.
I tried to reproduce the same in my environment and got the results like below:
I have created a vnet peering with two different space address like below:
Created a app service with premium p1v2 and added outbound traffic vnet integration and added a private endpoint like below:
Then, I created a vm and connect through bastion:
When I try to verify in command prompt using nslookup got result successfully like below:

Question concerning forward traffic on Azure Virtual Networks

I have a routing problem which I am struggling to solve in the Azure cloud platform concerning traffic that needs to be routed from one vnet to another vnet via another vnet and two VPN tunnels.
Here is a description of the set-up:
I do have two Azure Virtual Networks (VNET1 and VNET2) that each one has its own route-based Azure VPN Gateway and one 3rd party virtual network (VNET3) which is connected to the first Azure virtual network VNTE1 via an IPsec VPN tunnel. Below are the address spaces of all 3 virtual networks.
VNET1 10.20.0.0/16 (Azure vnet)
VNET2 10.30.0.0/16 (Azure vnet)
VNET3 10.0.0.0/12 (3rd party vnet)
Here is what I can do:
The VNET1 is connected via an IPsec VPN tunnel with the VNET3. Thus I am able to ping from a VM in the VNET1 10.20.10.5 a VM in the VNET3 10.0.0.1 and they can ping me back.
The VNET1 is connected via an IPsec VPN tunnel with VNET2. Thus, I am able to ping from a VM in the VNET1 10.20.10.5 a VM in the VNET2 10.30.10.5
Here what i cannot do:
I cannot ping from a VM in the VNET2 10.30.10.5 the VM in VNET3 10.0.0.1.
Here is what I tried to do to solve the problem without any success so far:
My assumption is that the network VNET2 does not know how to route the traffic to the network VNET3. Thus, I created an Azure Route table and I assigned the route table to the subnet 10.30.10.0/24 and I created the rule that all the traffic to the network 10.0.0.0/12 should be routed to the VPN GateWay of the VNTE2. My expectation is that once the traffic will go to the GW it will reach the VNET1 which knows how to route it to the VNET3. This didn't work.
Although I think is not needed since VNET1 already knows how to route the traffic to the VNET3 I have also created a routing table for 10.0.0.0/12 similar to the one above. This didn't help either.
Am I missing a route somewhere, If so which rule and where? Or do I even need to have a VM acting as a router? (I hope not)
I think your issue is the limitation of Azure Virtual Gateway:
The on-premises networks connecting through policy-based VPN devices with this mechanism can only connect to the Azure virtual network; they cannot transit to other on-premises networks or virtual networks via the same Azure VPN gateway.
https://learn.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-connect-multiple-policybased-rm-ps
So, even if you use the same VPN Gateway to connect with VNET 3 and VNET 2, by design VNET 3 and VNET 2 cannot communicate.
To resolve this issue, I recommend to use peering. Your configuration is similar to classic Hub-Spoke topology. Your VNET1 is Hub, VNET2 is Spoke, VNET3 is kind of "on-prem".
No changes needed to configuration between VNET1 and VNET3. You need to establish peering between VNET1 and VNET2 and backwards and apply following configuration:
Configure the peering connection in the hub to allow gateway transit.
Configure the peering connection in each spoke to use remote gateways.
Configure all peering connections to allow forwarded traffic.
https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/hub-spoke
In this case, VNET3 will be able to communicate with HUB (VNET1) and all spokes (VNET2 and any others connected to VNET1). VNET2 can communication with HUB (VNET1) and on-prem (VNET3) when the tunnel is up.
Warning: Spokes are not able to communicate between each other without a forwarding gateway in HUB, i.e. if you add VNET4 with peering to and from VNET1, VNET4 will not able to ping VMs in VNET2. But they could communicate with HUB and on-prem without any additional appliances.

Connecting App Service to Load Balanced cluster in different Resource Groups

I have 2 separate resource groups in Azure:
Contains some Services including a Linux App Service hosting Python Django
Contains an ElasticSearch cluster which I created using the ARM template from here
I want to connect from the App service in (1) to the ElasticSearch service load balancer in (2)
I tried to create a virtual network peering using
az network vnet peering create -g $webResourceGroup -n web2es --vnet-name vnet --remote-vnet $remote_vnet --allow-vnet-access
where $webResourceGroup => (1) and $remote_vnet => (2)
However, when I try to do an HTTP request to the ElasticSearch Service, it just does not work.
How do I fix or troubleshoot this?
There are some requirements and constraints for virtual network peering.
Resources in one virtual network cannot communicate with the front-end
IP address of a Basic internal load balancer in a globally peered
virtual network. Support for Basic Load Balancer only exists within
the same region. Support for Standard Load Balancer exists for both,
VNet Peering and Global VNet Peering. Services that use a Basic load
balancer which will not work over Global VNet Peering are documented
here.
So, if the peered VNets are in a different region, you cannot connect to resources that are behind a Basic Load Balancer through the Front End IP of the Load Balancer. This restriction does not exist for a Standard Load Balancer. From the parameters, you will see that loadBalancerInternalSku or loadBalancerExternalSku is by default basic, you should use a standard load balancer.
Also, you should have integrated your app with an Azure Virtual Network. Please note that you cannot reach resources across global peering connections(VNets are located in different regions) when you are using Regional VNet Integration which requires the app and the VNet must be in the same region. If so, you need to use Gateway required VNet Integration and VNet peering with gateway transit.
If possible, you could create all resources like VNet, app service, cluster in the same region. Then you do not need a VPN gateway for your VNet Integration. This may have fewer limitations and easier to deploy in your scenario.
Hope this could help you.

Virtual network peering connection azure

I have the following three virtual networks: - VNETa - VNETb - VNETc All the network traffic between the three virtual networks will be routed through VNET1a.
need to create the virtual networks, and then to ensure that all the Azure virtual machines can connect to other virtual machines by using their private IP address.
The solutions must NOT require any virtual gateways and must minimize the number of peerings. What should you do from the Azure portal before you configuring IP routing?
You could make peering between VNETa and VNETb, peering between VNETa and VNETc. Without a virtual network gateway and without a separate peering connection between those spokes VNETb and VNETc, to make the spoke connectivity, you need to deploy a virtual appliance as the hub in the network VNETa, then make two UDRs in each spoke VNets VNETb and VNETc to route traffic from one spoke network to another spoke network via NVA. In this scenario, you must configure the peering connections to allow forwarded traffic. see the explanation link.
For more details of UDR configuration, you could refer to this blog about Azure Networking - Hub-Spoke with NVA and Azure Firewall
The key to answering this question is to understand that the question is indicating that an IP routing solution will be configured after you have provisioned the necessary resources and configured appropriately: "...before you configure IP routing".
You do not need a gateway subnet or virtual gateways to implement a hub and spoke topology assuming that you are going to provision, for example, a VM with IP Forwarding enabled on the vNIC to act as a router.
Create your 3 subnets, in your example VNETa, VNETb and VNETc
From VNETa, create a peering with VNETb using the Resource Manager Deployment Model
Ensure "Allow forwarded traffic from VNETa to VNETb" is enabled
Repeat steps 2 & 3, substituting VNETb for VNETc
And that's it. Now when you configure IP routing you will provision a router VM or some other Network Virtual Appliance (NVA) in the hub network and create a Route Table for later application to VNETb and VNETc specifying the router VM's internal IP as the next hop.
Jamie.

Azure Virtual Network Gateway - Access resources in other resource groups

Let's take the following scenario:
I have a resource group in the East Region with 1 VM
I have a resource group in the West Region with 1 VM
Both of these VMs are only accessible via Private IP addresses. RDP via Public IP address is not an option. One would assume that in order for me to RDP to these machines, I would have to VPN into Azure's gateway first. However, I don't want to create a virtual gateway in every single resource group.
Is it possible for me to vpn into one resource (in one resource group), and access all of the machines in all other resource groups?
Yes, It's possible to do this with VNet peering(connecting VNets within the same Azure region). You could follow this to implement a hub-spoke network topology in Azure. In this case, the hub VNet is a peering VNet with allow gateway transit enabled and the spoke VNet is a peering VNet with use remote gateways enabled.
please note that you cannot use remote gateways or allow gateway transit with global peering(connecting VNets across Azure regions). Refer to requirements and constraints about global peering.
To use remote gateways or allow gateway transit, peered virtual
networks in must be in the same region.
so you have to move the peering VNets in the same region if the two VNets in each resource group are not in the same region.
Another option will create a separate VPN gateway in another resource group but this is not your expectation. Note that
A Point-to-Site client can only connect to resources in the VNet in
which the virtual network gateway resides.
Refer to VPN gateway FAQ.
You can use vnet peering with Use remote gateways checkbox enabled. You need to peer the vnets together and check use remote gateways on the second vnet (one without gateway).
Reading:
https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/hub-spoke
https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-peering-overview

Resources