Azure模板对AKS节点池的支持

时间:2019-05-06 22:03:14

标签: azure azure-aks azure-template

AKS最近发布了对节点池https://docs.microsoft.com/en-us/azure/aks/use-multiple-node-pools的支持。 ARM模板支持节点池吗?如果是这样,使用它们的语法是什么?我找不到在线有关ARM模板支持的任何文档。

2 个答案:

答案 0 :(得分:1)

不幸的是,恐怕您当前无法使用Azure模板创建具有多个节点池的AKS。在提供的文档中,需要使VMSS能够创建具有多个节点池的AKS。您只需在CLI preview version for AKS中启用代理类型即可。而且您无法在模板中找到它。

创建单个节点池的模板和创建多个节点池的模板都没有区别,除了属性agentPoolProfiles中的元素:

"agentPoolProfiles": [
                    {
                        "name": "nodepool1",
                        "count": 1,
                        "vmSize": "Standard_DS2_v2",
                        "osDiskSizeGB": 100,
                        "storageProfile": "ManagedDisks",
                        "maxPods": 110,
                        "osType": "Linux"
                    },
                    {
                        "name": "secnodepool",
                        "count": 1,
                        "vmSize": "Standard_DS2_v2",
                        "osDiskSizeGB": 100,
                        "storageProfile": "ManagedDisks",
                        "maxPods": 110,
                        "osType": "Linux"
                    }
                ],

我认为模板真正发布时将在模板中提供多个节点池,而不是预览版本。因此,您只需要耐心等待。

更新

为上述错误答案表示歉意。在“ 2019-02-01”“ apiVersion”中,您已经可以在“ agentPoolProfiles”的属性“ type”中将代理类型设置为“ VirtualMachineScaleSets”。我在“ 2018-03-31”“ apiVersion”中对其进行测试的错误。

答案 1 :(得分:1)

这是一个工作模板示例:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "resources": [
        {
            "type": "Microsoft.ContainerService/ManagedClusters",
            "apiVersion": "2019-04-01",
            "name": "aks-test",
            "location": "eastus",
            "properties": {
                "kubernetesVersion": "1.13.5",
                "dnsPrefix": "xxx",
                "agentPoolProfiles": [
                    {
                        "name": "nodepool1",
                        "count": 1,
                        "vmSize": "Standard_DS2_v2",
                        "osDiskSizeGB": 100,
                        "storageProfile": "ManagedDisks",
                        "maxPods": 110,
                        "osType": "Linux",
                        "enable_auto_scaling": true,
                        "min_count": 1,
                        "max_count": 3,
                        "type": "VirtualMachineScaleSets"
                    },
                    {
                        "name": "nodepool2",
                        "count": 1,
                        "vmSize": "Standard_DS2_v2",
                        "osDiskSizeGB": 100,
                        "storageProfile": "ManagedDisks",
                        "maxPods": 110,
                        "osType": "Linux",
                        "enable_auto_scaling": true,
                        "min_count": 1,
                        "max_count": 3,
                        "type": "VirtualMachineScaleSets"
                    }
                ],
                "linuxProfile": {
                    "adminUsername": "azureuser",
                    "ssh": {
                        "publicKeys": [
                            {
                                "keyData": "key"
                            }
                        ]
                    }
                },
                "servicePrincipalProfile": {
                    "clientId": "yyy",
                    "secret": "zzz"
                },
                "enableRBAC": true,
                "networkProfile": {
                    "networkPlugin": "kubenet",
                    "podCidr": "10.244.0.0/16",
                    "serviceCidr": "10.0.0.0/16",
                    "dnsServiceIP": "10.0.0.10",
                    "dockerBridgeCidr": "172.17.0.1/16"
                }
            }
        }
    ]
}

在运行此功能之前,您需要启用vmss预览。

enter image description here