If you have come across this post, you are wondering why when you create a AKS cluster in Azure an additional resource group is created with a lot of resources, right?
The answer is easy: by design.
When you create an AKS cluster in Azure, by design the name of the cluster follows the next convention:
MC_[resource group name]_[aks name]_[location]
Something like this:
MC_survey-rg_aks-oslvgax27o442_westeurope
This resource group contains all the infrastructure associated with the AKS cluster and it’s commonly called The node resource group and contains all of these resources:
- Master and node VMs
- Networking
- Storage
Using our custom name
In our ARM template we can change the name of the resource group in order to complaint with our naming conventions, normally guide by a governance plan, critical when we want to manage efficiently our clouds environments.
If you look inside the ARM documentation for the type Microsoft.ContainerService/managedClusters, there is a property called nodeResourceGroup so we can use to change the default name. In the next template, we are using a namming conventions guide by the governance plan of our customer:
"resources": [
{
"type": "Microsoft.ContainerService/managedClusters",
"tags": {
"displayName": "AKS",
"env": "dev",
"monitoring": "no"
},
"apiVersion": "2020-03-01",
"name": "[parameters('clusterName')]",
"location": "[parameters('location')]",
"properties": {
"nodeResourceGroup": "[concat(resourceGroup().name, '.aux')]",
"dnsPrefix": "[parameters('dnsPrefix')]",
"agentPoolProfiles": [
{
"name": "agentpool",
"osDiskSizeGB": "[parameters('osDiskSizeGB')]",
"count": "[parameters('agentCount')]",
"vmSize": "[parameters('agentVMSize')]",
"osType": "[parameters('osType')]",
"storageProfile": "ManagedDisks"
}
],
"linuxProfile": {
"adminUsername": "[parameters('linuxAdminUsername')]",
"ssh": {
"publicKeys": [
{
"keyData": "[parameters('sshRSAPublicKey')]"
}
]
}
},
"servicePrincipalProfile": {
"clientId": "[parameters('servicePrincipalClientId')]",
"Secret": "[parameters('servicePrincipalClientSecret')]"
}
}
}
]
As you’ve seen, it’s quite easy to change the name of the resource group.
Conclusion
In this post I’ve tried to show how easy it’s to change the name of the additional resource group created by the AKS cluster.
Comments