到目前为止,我一直找不到用于在AKS集群中创建节点的任何Azure库。我可以使用azure cli,但我的目标是使用python。
我可以使用azure python SDK创建资源和资源组-resource_groups.create_or_update('azure-sample-group',resource_group_params)
有人可以指出正确的文档或提示吗?感谢您的帮助。
答案 0 :(得分:0)
您可以执行此操作,here's the docs用于您要寻找的方法。 Here's the SDK code表示相同的内容。对于模型Managed Clusters
示例代码如下:
from azure.mgmt.containerservice import ContainerServiceClient # needed to create client
containerservice_client = ContainerServiceClient(get_credentials(), SUBSCRIPTION) # same way like you would for the resource_management_client
parameters = ManagedCluster(
location=location,
dns_prefix=dns_prefix,
kubernetes_version=kubernetes_version,
tags=stags,
service_principal_profile=service_principal_profile, # this needs to be a model as well
agent_pool_profiles=agent_pools, # this needs to be a model as well
linux_profile=linux_profile, # this needs to be a model as well
enable_rbac=true
)
containerservice_client.managed_clusters.create_or_update(resource_group, name, parameters)