配置静态出口IP后Azure Container Apps内部DNS解析失败求助
问题:Azure Container Apps容器间DNS解析失效(带NAT网关+Workload Profiles环境)
- 此前在无NAT网关的私有虚拟网络Container Apps环境(Consumption模式,无工作负载配置文件)中,容器可通过自动生成的私有URL(如
https://[mycontainer].[envname].westeurope.azurecontainerapps.io)正常实现HTTP通信。 - 因业务需求需为出口流量配置静态IP,将新的Container Apps环境部署到关联NAT网关和公网IP的子网中,并配置了Consumption类型的Workload Profiles,现在容器间通信失效,无法解析上述私有URL;手动指定Host头可通信,但不符合预期。
容器内nslookup结果对比
新环境(带NATGW、配置Workload Profiles)
nslookup mycontainer.myenv.westeurope.azurecontainerapps.io Server: 127.0.0.11 Address: 127.0.0.11#53 ** server can't find mycontainer.myenv.westeurope.azurecontainerapps.io: NXDOMAIN
旧环境(无NATGW、无Workload Profiles)
nslookup myapp.myenv.westeurope.azurecontainerapps.io ;; Got recursion not available from 9.0.0.2 ;; Got recursion not available from 9.0.0.2 ;; Got recursion not available from 9.0.0.2 ;; Got recursion not available from 9.0.0.2 Server: 9.0.0.2 Address: 9.0.0.2#53 Name: myapp.myenv.westeurope.azurecontainerapps.io Address: 9.0.12.173 ;; Got recursion not available from 9.0.0.2
- 已尝试配置私有DNS区域但未生效,请问是否需要配置带自定义路由的路由表?
环境部署Pulumi代码(C#)
var infraSubnet = new Network.Subnet(infraSubnetName, new Network.SubnetArgs() { ResourceGroupName = MyResourceGroup.Name, VirtualNetworkName = MyVirtualNetwork.Name, AddressPrefix = MyNaming.SubnetRanges.ContainerAppEnvSubnetRange, NatGateway = new SubResourceArgs() { Id = MyNATGateway.Id }, Delegations = new[] { // We need these delegations so we can new Network.Inputs.DelegationArgs() { Name = "Microsoft.App/environments", ServiceName = "Microsoft.App/environments" } }, }); var appManagedEnvironment = new App.ManagedEnvironment(MyContainerAppManagedEnvironmentName, new App.ManagedEnvironmentArgs() { ResourceGroupName = MyResourceGroup.Name, EnvironmentName = MyContainerAppManagedEnvironmentName, Location = ResourceGroup.Location, WorkloadProfiles = [ new WorkloadProfileArgs { Name = "Consumption", WorkloadProfileType = "Consumption" } ], VnetConfiguration = new App.Inputs.VnetConfigurationArgs() { InfrastructureSubnetId = infraSubnet.Id, Internal = true, }, ZoneRedundant = true, });
内容的提问来源于stack exchange,提问作者Erwin van der Valk
相关产品推荐
相关产品推荐

