Skip to content

Instantly share code, notes, and snippets.

@torumakabe
Last active June 19, 2018 15:12
Show Gist options
  • Save torumakabe/5453ffc253eb87246b14fd6c9989bad6 to your computer and use it in GitHub Desktop.
Save torumakabe/5453ffc253eb87246b14fd6c9989bad6 to your computer and use it in GitHub Desktop.
Azure Resource Manager Template for AKS (All in: as of June 19, 2018)
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceName": {
"type": "string",
"metadata": {
"description": "The name of the Managed Cluster resource."
}
},
"location": {
"type": "string",
"metadata": {
"description": "The location of AKS resource."
}
},
"dnsPrefix": {
"type": "string",
"metadata": {
"description": "Optional DNS prefix to use with hosted Kubernetes API server FQDN."
}
},
"osDiskSizeGB": {
"type": "int",
"defaultValue": 0,
"metadata": {
"description": "Disk size (in GB) to provision for each of the agent pool nodes. This value ranges from 0 to 1023. Specifying 0 will apply the default disk size for that agentVMSize."
},
"minValue": 0,
"maxValue": 1023
},
"agentCount": {
"type": "int",
"defaultValue": 3,
"metadata": {
"description": "The number of agent nodes for the cluster."
},
"minValue": 1,
"maxValue": 50
},
"agentVMSize": {
"type": "string",
"defaultValue": "Standard_D2_v2",
"metadata": {
"description": "The size of the Virtual Machine."
}
},
"servicePrincipalClientId": {
"metadata": {
"description": "Client ID (used by cloudprovider)"
},
"type": "securestring"
},
"servicePrincipalClientSecret": {
"metadata": {
"description": "The Service Principal Client Secret."
},
"type": "securestring"
},
"aadClientAppID": {
"metadata": {
"description": "Azure AD Clinet App ID."
},
"type": "securestring"
},
"aadServerAppID": {
"metadata": {
"description": "Azure AD Server App ID."
},
"type": "securestring"
},
"aadServerAppSecret": {
"metadata": {
"description": "Azure AD Server App Secret."
},
"type": "securestring"
},
"aadTenantID": {
"metadata": {
"description": "Azure AD Tenant ID."
},
"type": "securestring"
},
"osType": {
"type": "string",
"defaultValue": "Linux",
"allowedValues": [
"Linux"
],
"metadata": {
"description": "The type of operating system."
}
},
"kubernetesVersion": {
"type": "string",
"defaultValue": "1.9.6",
"metadata": {
"description": "The version of Kubernetes."
}
},
"enableOmsAgent": {
"type": "bool",
"defaultValue": true,
"metadata": {
"description": "boolean flag to turn on and off of omsagent addon"
}
},
"omsWorkspaceRegion": {
"type": "string",
"defaultValue": "East US",
"metadata": {
"description": "Specify the region for your OMS workspace"
}
},
"omsWorkspaceId": {
"type": "string",
"metadata": {
"description": "Specify the resource id of the OMS workspace"
}
},
"enableHttpApplicationRouting": {
"type": "bool",
"defaultValue": true,
"metadata": {
"description": "boolean flag to turn on and off of http application routing"
}
},
"networkPlugin": {
"type": "string",
"allowedValues": [
"azure",
"kubenet"
],
"metadata": {
"description": "Network plugin used for building Kubernetes network."
}
},
"maxPods": {
"type": "int",
"defaultValue": 30,
"metadata": {
"description": "Maximum number of pods that can run on a node."
}
},
"serviceCidr": {
"type": "string",
"metadata": {
"description": "A CIDR notation IP range from which to assign service cluster IPs."
}
},
"dnsServiceIP": {
"type": "string",
"metadata": {
"description": "Containers DNS server IP address."
}
},
"dockerBridgeCidr": {
"type": "string",
"metadata": {
"description": "A CIDR notation IP for Docker bridge."
}
}
},
"resources": [
{
"apiVersion": "2018-03-31",
"dependsOn": [
"Microsoft.Network/virtualNetworks/default"
],
"type": "Microsoft.ContainerService/managedClusters",
"location": "[parameters('location')]",
"name": "[parameters('resourceName')]",
"properties": {
"kubernetesVersion": "[parameters('kubernetesVersion')]",
"enableRBAC": true,
"dnsPrefix": "[parameters('dnsPrefix')]",
"addonProfiles": {
"httpApplicationRouting": {
"enabled": "[parameters('enableHttpApplicationRouting')]"
},
"omsagent": {
"enabled": "[parameters('enableOmsAgent')]",
"config": {
"logAnalyticsWorkspaceResourceID": "[parameters('omsWorkspaceId')]"
}
}
},
"agentPoolProfiles": [
{
"name": "agentpool",
"osDiskSizeGB": "[parameters('osDiskSizeGB')]",
"count": "[parameters('agentCount')]",
"vmSize": "[parameters('agentVMSize')]",
"osType": "[parameters('osType')]",
"storageProfile": "ManagedDisks",
"vnetSubnetID": "[resourceId('Microsoft.Network/virtualNetworks/subnets','default', 'default')]"
}
],
"servicePrincipalProfile": {
"ClientId": "[parameters('servicePrincipalClientId')]",
"Secret": "[parameters('servicePrincipalClientSecret')]"
},
"networkProfile": {
"networkPlugin": "[parameters('networkPlugin')]",
"serviceCidr": "[parameters('serviceCidr')]",
"dnsServiceIP": "[parameters('dnsServiceIP')]",
"dockerBridgeCidr": "[parameters('dockerBridgeCidr')]"
},
"aadProfile": {
"clientAppID": "[parameters('aadClientAppID')]",
"serverAppID": "[parameters('aadServerAppID')]",
"serverAppSecret": "[parameters('aadServerAppSecret')]",
"tenantID": "[parameters('aadTenantID')]"
}
},
"tags": {}
},
{
"type": "Microsoft.Resources/deployments",
"name": "SolutionDeployment",
"apiVersion": "2017-05-10",
"resourceGroup": "[split(parameters('omsWorkspaceId'),'/')[4]]",
"subscriptionId": "[split(parameters('omsWorkspaceId'),'/')[2]]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"apiVersion": "2015-11-01-preview",
"type": "Microsoft.OperationsManagement/solutions",
"location": "[parameters('omsWorkspaceRegion')]",
"name": "[concat('ContainerInsights', '(', split(parameters('omsWorkspaceId'),'/')[8], ')')]",
"properties": {
"workspaceResourceId": "[parameters('omsWorkspaceId')]"
},
"plan": {
"name": "[concat('ContainerInsights', '(', split(parameters('omsWorkspaceId'),'/')[8], ')')]",
"product": "[concat('OMSGallery/', 'ContainerInsights')]",
"promotionCode": "",
"publisher": "Microsoft"
}
}
]
}
},
"dependsOn": []
},
{
"name": "default",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2018-02-01",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"172.16.0.0/16"
]
},
"subnets": [
{
"name": "default",
"properties": {
"addressPrefix": "172.16.0.0/24"
}
}
]
}
}
],
"outputs": {
"controlPlaneFQDN": {
"type": "string",
"value": "[reference(concat('Microsoft.ContainerService/managedClusters/', parameters('resourceName'))).fqdn]"
}
}
}
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceName": {
"value": "your-aks-name"
},
"location": {
"value": "eastus"
},
"dnsPrefix": {
"value": "your-aks-name"
},
"agentCount": {
"value": 2
},
"agentVMSize": {
"value": "Standard_B2ms"
},
"servicePrincipalClientId": {
"value": "your-servicePrincipalClientId"
},
"servicePrincipalClientSecret": {
"value": "your-servicePrincipalClientSecret"
},
"aadClientAppID": {
"value": "your-aadClientAppID"
},
"aadServerAppID": {
"value": "your-aadServerAppID"
},
"aadServerAppSecret": {
"value": "your-aadServerAppSecret"
},
"aadTenantID": {
"value": "your-aadTenantID"
},
"kubernetesVersion": {
"value": "1.9.6"
},
"omsWorkspaceId": {
"value": "/subscriptions/your-subscription/resourcegroups/your-oms-resourcegroup/providers/microsoft.operationalinsights/workspaces/your-oms-workspace-name"
},
"omsWorkspaceRegion": {
"value": "eastus"
},
"enableHttpApplicationRouting": {
"value": true
},
"networkPlugin": {
"value": "azure"
},
"serviceCidr": {
"value": "10.0.0.0/16"
},
"dnsServiceIP": {
"value": "10.0.0.10"
},
"dockerBridgeCidr": {
"value": "172.17.0.1/16"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment