1

I want to add Windows Server Container to Azure kubernetes Cluster.Currenty,using the Azure Rest API to manage the cluster.But It is showing the following error:

{
  "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."
}
Mengdi Liang
  • 17,577
  • 2
  • 28
  • 35

1 Answers1

1

From your question, I assume that you want to add the Windows node pool to the AKS cluster. And then the error means you do not use the Azure-CNI network type for your AKS cluster. For the Windows node pool, see below:

In order to run an AKS cluster that supports node pools for Windows Server containers, your cluster needs to use a network policy that uses Azure CNI (advanced) network plugin.

So the solution for you is to create a new AKS cluster with the Azure-CNI network type. And then add the Windows node pool again. Take a look at the steps that Create AKS cluster for Windows node pool through Azure CLI. And in REST API, you need to set the networkPlugin in the properties.networkProfile with value azure. See NetworkPlugin.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39