azure - 通过 ARM 模板将节点池添加到现有 AKS 群集
问题描述
我有一个现有的 AKS 集群(我知道它的名称和其他详细信息)
是否可以使用 ARM 模板向现有 AKS 群集添加额外的节点池?
解决方案
是否可以使用 ARM 模板向现有 AKS 群集添加额外的节点池?
是的,可以向现有 AKS 群集添加额外的节点池。
使用资源管理器模板管理节点池
使用 Azure 资源管理器模板创建和管理资源时,通常可以更新模板中的设置并重新部署以更新资源。对于 AKS 中的节点池,一旦创建 AKS 群集,就无法更新初始节点池配置文件。此行为意味着您无法更新现有资源管理器模板、更改节点池和重新部署。相反,您必须创建一个单独的资源管理器模板,该模板仅更新现有 AKS 群集的节点池。
创建一个模板,例如 aks-agentpools.json
并粘贴以下示例清单。此示例模板配置以下设置:
- 更新 名为myagentpool的Linux 节点池以 运行三个节点。
- 将节点池中的节点设置为运行 Kubernetes 版本 1.15.7。
- 将节点大小定义为 Standard_DS2_v2。
根据需要编辑这些值,以根据需要更新、添加或删除节点池:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"type": "string",
"metadata": {
"description": "The name of your existing AKS cluster."
}
},
"location": {
"type": "string",
"metadata": {
"description": "The location of your existing AKS cluster."
}
},
"agentPoolName": {
"type": "string",
"defaultValue": "myagentpool",
"metadata": {
"description": "The name of the agent pool to create or update."
}
},
"vnetSubnetId": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "The Vnet subnet resource ID for your existing AKS cluster."
}
}
},
"variables": {
"apiVersion": {
"aks": "2020-01-01"
},
"agentPoolProfiles": {
"maxPods": 30,
"osDiskSizeGB": 0,
"agentCount": 3,
"agentVmSize": "Standard_DS2_v2",
"osType": "Linux",
"vnetSubnetId": "[parameters('vnetSubnetId')]"
}
},
"resources": [
{
"apiVersion": "2020-01-01",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "[concat(parameters('clusterName'),'/', parameters('agentPoolName'))]",
"location": "[parameters('location')]",
"properties": {
"maxPods": "[variables('agentPoolProfiles').maxPods]",
"osDiskSizeGB": "[variables('agentPoolProfiles').osDiskSizeGB]",
"count": "[variables('agentPoolProfiles').agentCount]",
"vmSize": "[variables('agentPoolProfiles').agentVmSize]",
"osType": "[variables('agentPoolProfiles').osType]",
"storageProfile": "ManagedDisks",
"type": "VirtualMachineScaleSets",
"vnetSubnetID": "[variables('agentPoolProfiles').vnetSubnetId]",
"orchestratorVersion": "1.15.7"
}
}
]
}
使用az deployment group create命令部署此模板,如以下示例所示。系统会提示您输入现有的 AKS 群集名称和位置:
--Azure CLI
az deployment group create \
--resource-group myResourceGroup \
--template-file aks-agentpools.json
有关更多详细信息,您可以参考这篇使用 ARM 在现有 AKS 群集中管理节点池
还,
将专用系统节点池添加到现有 AKS 群集
您可以将一个或多个系统节点池添加到现有 AKS 群集。
以下命令添加模式类型系统的专用节点池,默认计数为三个节点。
az aks nodepool add \
--resource-group myResourceGroup \
--cluster-name myAKSCluster \
--name systempool \
--node-count 3 \
--node-taints CriticalAddonsOnly=true:NoSchedule \
--mode System
有关添加专用系统的更多详细信息,请参阅此 [ documentation-of-usingSystemPools-in-existing-AKS-Cluster ]
要了解使用ARM 模板创建Azure 节点池中的每个命令详细信息,请参阅此 [ MSFT 文档],它可以让您清楚地了解每个命令。
如果要[使用 azure 命令工具在现有 AKS 群集中创建新节点池],请参阅此内容
如果您想 [使用 ARM 模板部署具有节点池和 AAD 身份验证的 AKS ],请参阅此处。
推荐阅读
- java - 从 SQLite 数据库添加和检索图像
- sql - 如何进行正确的计算?
- javascript - 为多个击键创建单个键快捷方式
- android - Android Studio - 检索 android 设备目录时出错
- javascript - 如何以角度呈现数组中的HTML
- javascript - 如何让 forEach 循环等待正则表达式替换?
- azure-functions - azure 函数如何测量 GB 以进行计费?
- reactjs - 如何修复 inifnity 循环?
- python - 如何从 Frozen Tuple Map 添加新列?
- css - 如何在段落的左侧创建一条垂直线(带半径)?