Skip to content

Instantly share code, notes, and snippets.

@PixelRobots
Last active January 5, 2020 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PixelRobots/97325c7024686b979523ac63221de2d8 to your computer and use it in GitHub Desktop.
Save PixelRobots/97325c7024686b979523ac63221de2d8 to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string",
"metadata": {
"description": "AKS cluster name"
}
},
"kubernetesVersion": {
"type": "string",
"metadata": {
"description": "Kubernetes version"
},
"defaultValue": "1.14.8"
},
"agentPoolProfiles": {
"type": "array",
"metadata": {
"description": "Define one or multiple node pools"
},
"defaultValue": [
{
"nodeCount": 3,
"nodeVmSize": "Standard_D2_v3",
"availabilityZones": [
"1",
"2",
"3"
],
"enableAutoScaling": true,
"maxCount": 10,
"minCount": 3
}
]
},
"workspaceResourceGroup": {
"type": "string",
"metadata": {
"description": "Log Analytics workspace resource group name"
}
},
"workspaceName": {
"type": "string",
"metadata": {
"description": "Log Analytics workspace name that has the Container Insights solution enabled"
}
},
"vnetResourceGroupName": {
"type": "string",
"metadata": {
"description": "Virtual Network resource group name"
}
},
"vnetName": {
"type": "string",
"metadata": {
"description": "Virtual Network name"
}
},
"vnetSubnetName": {
"type": "string",
"metadata": {
"description": "Virtual Network subnet name"
}
},
"servicePrincipalClientId": {
"type": "securestring",
"metadata": {
"description": "Service Principal client id"
}
},
"servicePrincipalClientSecret": {
"type": "securestring",
"metadata": {
"description": "Service Principal client secret"
}
},
"aadClientAppId": {
"type": "securestring",
"metadata": {
"description": "AAD client application id"
}
},
"aadServerAppId": {
"type": "securestring",
"metadata": {
"description": "AAD server application id"
}
},
"aadServerAppSecret": {
"type": "securestring",
"metadata": {
"description": "AAD server application secret"
}
},
"aadTenantId": {
"type": "securestring",
"metadata": {
"description": "AAD tenant id"
}
}
},
"variables": {
"apiVersion": {
"aks": "2019-08-01"
},
"agentPoolProfiles": {
"vnetSubnetId": "[concat(resourceId(parameters('vnetResourceGroupName'),'Microsoft.Network/virtualNetworks',parameters('vnetName')),'/subnets/',parameters('vnetSubnetName'))]"
},
"cluster": {
"workspaceId": "[resourceId(parameters('workspaceResourceGroup'),'Microsoft.OperationalInsights/workspaces',parameters('workspaceName'))]"
},
"outputs": {
"resourceId": "[resourceId('Microsoft.ContainerService/managedClusters/',parameters('name'))]"
}
},
"resources": [
{
"apiVersion": "[variables('apiVersion').aks]",
"type": "Microsoft.ContainerService/managedClusters",
"name": "[parameters('name')]",
"location": "[resourceGroup().location]",
"properties": {
"nodeResourceGroup": "[concat(parameters('name'),'-worker')]",
"kubernetesVersion": "[parameters('kubernetesVersion')]",
"enableRBAC": true,
"dnsPrefix": "[parameters('name')]",
"addonProfiles": {
"kubeDashboard": {
"enabled": false
},
"omsagent": {
"enabled": true,
"config": {
"logAnalyticsWorkspaceResourceID": "[variables('cluster').workspaceId]"
}
}
},
"copy": [
{
"name": "agentPoolProfiles",
"count": "[length(parameters('agentPoolProfiles'))]",
"input": {
"name": "[concat('nodepool',add(copyIndex('agentPoolProfiles'),1))]",
"maxPods": 250,
"osDiskSizeGB": 128,
"count": "[parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].nodeCount]",
"vmSize": "[parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].nodeVmSize]",
"osType": "Linux",
"vnetSubnetID": "[variables('agentPoolProfiles').vnetSubnetId]",
"enableAutoScaling": "[if(parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].enableAutoScaling, parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].enableAutoScaling, json('null'))]",
"maxCount": "[if(parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].enableAutoScaling, parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].maxCount, json('null'))]",
"minCount": "[if(parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].enableAutoScaling, parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].minCount, json('null'))]",
"type": "VirtualMachineScaleSets",
"availabilityZones": "[parameters('agentPoolProfiles')[copyIndex('agentPoolProfiles')].availabilityZones]"
}
}
],
"networkProfile": {
"loadBalancerSku": "standard",
"networkPlugin": "azure",
"networkPolicy": "azure",
"serviceCidr": "10.0.0.0/16",
"dnsServiceIp": "10.0.0.10",
"dockerBridgeCidr": "172.17.0.1/16"
},
"servicePrincipalProfile": {
"clientId": "[parameters('servicePrincipalClientId')]",
"secret": "[parameters('servicePrincipalClientSecret')]"
},
"aadProfile": {
"clientAppID": "[parameters('aadClientAppId')]",
"serverAppID": "[parameters('aadServerAppId')]",
"serverAppSecret": "[parameters('aadServerAppSecret')]",
"tenantId": "[parameters('aadTenantId')]"
}
}
}
],
"outputs": {
"name": {
"type": "string",
"value": "[parameters('name')]"
},
"resourceId": {
"type": "string",
"value": "[variables('outputs').resourceId]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment