微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决在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)

不需要网络贡献者角色。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。