首页 > 解决方案 > 无法使用 Rest API 将 Windows 节点拉入集群

问题描述

我想将 Windows Server 容器添加到 Azure kubernetes Cluster.Currenty,使用 Azure Rest API 来管理集群。但它显示以下错误:

{
  "code": "AzureCNIOnlyForWindows",
  "message": "Windows agent pools can only be added to AKS clusters using Azure-CNI."
}

{
  "location": "location1",
  "tags": {
    "tier": "production",
    "archv2": ""
  },
  "properties": {
    "kubernetesVersion": "",
    "dnsPrefix": "dnsprefix1",
    "agentPoolProfiles": [
      {
        "name": "nodepool1",
        "count": 3,
        "vmSize": "Standard_DS1_v2",
        "osType": "Linux"
      }
    ],
    "linuxProfile": {
      "adminUsername": "*******",
      "ssh": {
        "publicKeys": [
          {
            "keyData": "keydata"
          }
        ]
      }
    },
    "networkProfile": {
      "loadBalancerSku": "basic"
    },
    "windowsProfile": {
      "adminUsername": "********",
      "adminPassword": "************************"
    },
    "servicePrincipalProfile": {
      "clientId": "clientid",
      "secret": "secret"
    },
    "addonProfiles": {},
    "enableRBAC": true,
    "enablePodSecurityPolicy": true
  }
}

{
  "code": "AzureCNIOnlyForWindows",
  "message": "Windows agent pools can only be added to AKS clusters using Azure-CNI."
}

标签: azureazure-rest-api

解决方案


根据您的问题,我假设您希望将 Windows 节点池添加到 AKS 群集。然后错误意味着您没有为 AKS 群集使用 Azure-CNI 网络类型。对于 Windows 节点池,请参见下文:

为了运行支持 Windows Server 容器的节点池的 AKS 群集,你的群集需要使用使用 Azure CNI(高级)网络插件的网络策略。

因此,您的解决方案是使用 Azure-CNI 网络类型创建一个新的 AKS 群集。然后再次添加 Windows 节点池。查看通过 Azure CLI 为 Windows 节点池创建 AKS 群集的步骤。而在 REST API 中,您需要networkPluginproperties.networkProfilewith value中设置azure。请参阅网络插件


推荐阅读