如何在启用 Calico 的情况下安装 AKS

How to install AKS with Calico enabled

This definition 清楚地提到您可以使用 networkPolicy 属性 作为 networkProfile 的一部分并将其设置为 Calico,但这不起作用。 AKS 创建超时,所有节点都处于 Not Ready 状态。

您需要启用底层提供程序功能:

az feature list --query "[?contains(name, 'Container')].{name:name, type:type}" # example to list all features
az feature register --name EnableNetworkPolicy --namespace Microsoft.ContainerService
az provider register -n Microsoft.ContainerService

之后,您可以使用 REST API\ARM 模板来创建 AKS:

{
  "location": "location1",
  "tags": {
    "tier": "production",
    "archv2": ""
  },
  "properties": {
    "kubernetesVersion": "1.12.4", // has to be 1.12.x, 1.11.x doesnt support calico AFAIK
    "dnsPrefix": "dnsprefix1",
    "agentPoolProfiles": [
      {
        "name": "nodepool1",
        "count": 3,
        "vmSize": "Standard_DS1_v2",
        "osType": "Linux"
      }
    ],
    "linuxProfile": {
      "adminUsername": "azureuser",
      "ssh": {
        "publicKeys": [
          {
            "keyData": "keydata"
          }
        ]
      }
    },
    "servicePrincipalProfile": {
      "clientId": "clientid",
      "secret": "secret"
    },
    "addonProfiles": {},
    "enableRBAC": false,
    "networkProfile": {
        "networkPlugin": "azure",
        "networkPolicy": "calico", // set policy here
        "serviceCidr": "xxx",
        "dnsServiceIP": "yyy",
        "dockerBridgeCidr": "zzz"
    }
  }
}

ps。 不幸的是,在撰写本文时,helm 似乎不起作用(我怀疑这是因为 helm 所依赖的 kubectl port-forward 也不起作用)。