question

TimJin-1583 avatar image
0 Votes"
TimJin-1583 asked TimJin-3574 commented

Updating AKS node pools thru ARM template doesn't work

Based on https://docs.microsoft.com/en-gb/azure/aks/use-multiple-node-pools#manage-node-pools-using-a-resource-manager-template, I created a aks-agentpools.json by copying the code there and provided clusterName as "tmp-apps-dev-aks-02-12" in parameter json file. The AKS "tmp-apps-dev-aks-02-12" has been created previously

While deploying, it raised error:
{"error":{"code":"InvalidTemplate","message":"Deployment template validation failed: 'The template reference 'tmp-apps-dev-aks-02-12' is not valid: could not find template resource or resource copy with this name. Please see https://aka.ms/arm-template-expressions/#reference for usage details.'.","additionalInfo":[{"type":"TemplateViolation","info":{"lineNumber":0,"linePosition":0,"path":""}}]}}

It seems to me that the example template doesn't reference the cluster defined in another template correctly. Could you please provide a working sample in which configuration of node pools can be updated in a separate ARM template (cluster with original node pools settings is defined and deployed in another template)?

azure-kubernetes-service
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@TimJin-1583 , thank you for reaching out to us. Happy to help. I tried running the script given in the docs, and it runs fine for me provided I keep below mention in the document in mind:

With node pools in AKS, the initial node pool profile can't be updated once the AKS cluster has been created. This behavior means that you can't update an existing Resource Manager template, make a change to the node pools, and redeploy. Instead, you must create a separate Resource Manager template that updates only the node pools for an existing AKS cluster.

I would suggest below points to take care for this error:

  • Make sure there is no dependsOn key that depends on tmp-apps-dev-aks-02-12 in your agentpool template resource.

  • Make sure you are deploying this change in same Resource group as that of the AKS cluster.

Let me know if this helps you resolve the error.



0 Votes 0 ·

@TimJin-1583 , just checking in to see if you got a chance to check my previous response.

0 Votes 0 ·

Hi @HarshitaSingh-MSFT ,

Sorry for late response as yesterday is public holiday in New Zealand.

I found it was caused by following configuration in my aks-agentpools.json. After removing it, deployment can be done successfully thru this separate template.
"outputs": {
"controlPlaneFQDN": {
"type": "string",
"value": "[reference(parameters('clusterName')).fqdn]"
}
}"

Then I did a few experiment and got a few questions. Because of the character limitation, I posted it on https://docs.microsoft.com/en-us/answers/questions/372736/adddeleteupdate-node-pools-in-aks-thru-arm-templat.html

0 Votes 0 ·

Ok, sure, I will have a look at it.

0 Votes 0 ·

0 Answers