【问题标题】:Deploying node to AKS cluster using azure-sdk-for-python使用 azure-sdk-for-python 将节点部署到 AKS 群集
【发布时间】:2019-01-31 19:35:23
【问题描述】:
到目前为止,我无法找到任何用于在 AKS 群集中创建节点的 azure 库。我可以使用 azure cli,但我的目标是使用 python。
我可以使用 azure python SDK - resource_groups.create_or_update('azure-sample-group', resource_group_params) 创建资源和资源组
谁能给我指出正确的文档或一些提示?感谢您的所有帮助。
【问题讨论】:
标签:
azure
kubernetes
azure-aks
azure-resource-group
azure-sdk-python
【解决方案1】:
你可以这样做,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)