在Azure上通过AMLS在内部负载均衡器中配置AKS

问题描述

我想提供一个连接到vnet并在Azure上具有内部负载平衡器的AKS群集。我正在使用here中的代码,如下所示:

convert -size 500x500 xc:white -fill cropped.jpeg -draw "circle 250,250 250,1" circ.jpg

但是,出现以下错误

import azureml.core
from azureml.core.compute import AksCompute,ComputeTarget

# Verify that cluster does not exist already
try:
    aks_target = AksCompute(workspace=ws,name=aks_cluster_name)
    print("Found existing aks cluster")

except:
    print("Creating new aks cluster")

    # subnet to use for AKS
    subnet_name = "default"
    # Create AKS configuration
    prov_config=AksCompute.provisioning_configuration(load_balancer_type="InternalLoadBalancer")
    # Set info for existing virtual network to create the cluster in
    prov_config.vnet_resourcegroup_name = "myvnetresourcegroup"
    prov_config.vnet_name = "myvnetname"
    prov_config.service_cidr = "10.0.0.0/16"
    prov_config.dns_service_ip = "10.0.0.10"
    prov_config.subnet_name = subnet_name
    prov_config.docker_bridge_cidr = "172.17.0.1/16"

    # Create compute target
    aks_target = ComputeTarget.create(workspace = ws,name = "myaks",provisioning_configuration = prov_config)
    # Wait for the operation to complete
    aks_target.wait_for_completion(show_output = True)

这是因为AKS群集尚未为vnet资源组充当“网络贡献者”角色?是使该方法起作用的唯一方法,是首先在AMLS之外创建AKS,将网络贡献者角色授予vnet资源组,然后将AKS群集附加到AMLS,然后再配置内部负载均衡器?

解决方法

我首先通过在没有内部负载均衡器的情况下创建AKS资源,然后按照以下代码分别更新负载均衡器来使它工作:

import azureml.core
from azureml.core.compute.aks import AksUpdateConfiguration
from azureml.core.compute import AksCompute

# ws = workspace object. Creation not shown in this snippet
aks_target = AksCompute(ws,"myaks")

# Change to the name of the subnet that contains AKS
subnet_name = "default"
# Update AKS configuration to use an internal load balancer
update_config = AksUpdateConfiguration(None,"InternalLoadBalancer",subnet_name)
aks_target.update(update_config)
# Wait for the operation to complete
aks_target.wait_for_completion(show_output = True)

不需要网络贡献者角色。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...