Created
May 28, 2018 17:09
-
-
Save tomconte/648feba4b209745a7ea53d797d3f4cb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$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." | |
| } | |
| }, | |
| "dnsPrefix": { | |
| "type": "String", | |
| "metadata": { | |
| "description": "Optional DNS prefix to use with hosted Kubernetes API server FQDN." | |
| } | |
| }, | |
| "osDiskSizeGB": { | |
| "defaultValue": 0, | |
| "minValue": 0, | |
| "maxValue": 1023, | |
| "type": "Int", | |
| "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." | |
| } | |
| }, | |
| "agentCount": { | |
| "defaultValue": 3, | |
| "minValue": 1, | |
| "maxValue": 50, | |
| "type": "Int", | |
| "metadata": { | |
| "description": "The number of nodes for the cluster." | |
| } | |
| }, | |
| "agentVMSize": { | |
| "defaultValue": "Standard_D2_v2", | |
| "allowedValues": [ | |
| "Standard_A10", | |
| "Standard_A11", | |
| "Standard_A2", | |
| "Standard_A2_v2", | |
| "Standard_A2m_v2", | |
| "Standard_A3", | |
| "Standard_A4", | |
| "Standard_A4_v2", | |
| "Standard_A4m_v2", | |
| "Standard_A5", | |
| "Standard_A6", | |
| "Standard_A7", | |
| "Standard_A8", | |
| "Standard_A8_v2", | |
| "Standard_A8m_v2", | |
| "Standard_A9", | |
| "Standard_D11", | |
| "Standard_D11_v2", | |
| "Standard_D12", | |
| "Standard_D12_v2", | |
| "Standard_D13", | |
| "Standard_D13_v2", | |
| "Standard_D14", | |
| "Standard_D14_v2", | |
| "Standard_D15_v2", | |
| "Standard_D2", | |
| "Standard_D2_v2", | |
| "Standard_D3", | |
| "Standard_D3_v2", | |
| "Standard_D4", | |
| "Standard_D4_v2", | |
| "Standard_D5_v2", | |
| "Standard_DS11", | |
| "Standard_DS11_v2", | |
| "Standard_DS12", | |
| "Standard_DS12_v2", | |
| "Standard_DS13", | |
| "Standard_DS13_v2", | |
| "Standard_DS14", | |
| "Standard_DS14_v2", | |
| "Standard_DS15_v2", | |
| "Standard_DS2", | |
| "Standard_DS2_v2", | |
| "Standard_DS3", | |
| "Standard_DS3_v2", | |
| "Standard_DS4", | |
| "Standard_DS4_v2", | |
| "Standard_DS5_v2", | |
| "Standard_F16", | |
| "Standard_F16s", | |
| "Standard_F2", | |
| "Standard_F2s", | |
| "Standard_F4", | |
| "Standard_F4s", | |
| "Standard_F8", | |
| "Standard_F8s", | |
| "Standard_G1", | |
| "Standard_G2", | |
| "Standard_NC6", | |
| "Standard_NC12", | |
| "Standard_NC24", | |
| "Standard_NC24r", | |
| "Standard_NV6", | |
| "Standard_NV12", | |
| "Standard_NV24", | |
| "Standard_B1s", | |
| "Standard_B1ms", | |
| "Standard_B2s", | |
| "Standard_B2ms", | |
| "Standard_B4ms", | |
| "Standard_B8ms" | |
| ], | |
| "type": "String", | |
| "metadata": { | |
| "description": "The size of the Virtual Machine." | |
| } | |
| }, | |
| "linuxAdminUsername": { | |
| "defaultValue": "azureuser", | |
| "type": "String", | |
| "metadata": { | |
| "description": "User name for the Linux Virtual Machines." | |
| } | |
| }, | |
| "sshRSAPublicKey": { | |
| "type": "String", | |
| "metadata": { | |
| "description": "Configure all linux machines with the SSH RSA public key string. Your key should include three parts, for example 'ssh-rsa AAAAB...snip...UcyupgH azureuser@linuxvm'" | |
| } | |
| }, | |
| "servicePrincipalClientId": { | |
| "defaultValue": "n/a", | |
| "type": "SecureString", | |
| "metadata": { | |
| "description": "Client ID (used by cloudprovider)" | |
| } | |
| }, | |
| "servicePrincipalClientSecret": { | |
| "defaultValue": "n/a", | |
| "type": "SecureString", | |
| "metadata": { | |
| "description": "The Service Principal Client Secret." | |
| } | |
| }, | |
| "osType": { | |
| "defaultValue": "Linux", | |
| "allowedValues": [ | |
| "Linux" | |
| ], | |
| "type": "String", | |
| "metadata": { | |
| "description": "The type of operating system." | |
| } | |
| }, | |
| "kubernetesVersion": { | |
| "defaultValue": "1.8.7", | |
| "allowedValues": [ | |
| "1.8.7", | |
| "1.7.12" | |
| ], | |
| "type": "String", | |
| "metadata": { | |
| "description": "The version of Kubernetes." | |
| } | |
| }, | |
| "TFRPlocation": { | |
| "type": "String", | |
| "defaultValue": "westcentralus", | |
| "metadata": { | |
| "description": "The location of the TFRP." | |
| } | |
| } | |
| }, | |
| "variables": { | |
| "resourceName": "[parameters('resourceName')]", | |
| "adminUsername": "[parameters('linuxAdminUsername')]", | |
| "osDiskSizeGB": "[parameters('osDiskSizeGB')]", | |
| "agentCount": "[parameters('agentCount')]", | |
| "agentVMSize": "[parameters('agentVMSize')]", | |
| "dnsPrefix": "[parameters('dnsPrefix')]", | |
| "sshRSAPublicKey": "[parameters('sshRSAPublicKey')]", | |
| "servicePrincipalClientId": "[parameters('servicePrincipalClientId')]", | |
| "servicePrincipalClientSecret": "[parameters('servicePrincipalClientSecret')]", | |
| "osType": "[parameters('osType')]", | |
| "kubernetesVersion": "[parameters('kubernetesVersion')]" | |
| }, | |
| "resources": [ | |
| { | |
| "type": "Microsoft.ContainerService/managedClusters", | |
| "name": "[variables('resourceName')]", | |
| "apiVersion": "2017-08-31", | |
| "location": "[resourceGroup().location]", | |
| "properties": { | |
| "kubernetesVersion": "[variables('kubernetesVersion')]", | |
| "dnsPrefix": "[variables('dnsPrefix')]", | |
| "agentPoolProfiles": [ | |
| { | |
| "name": "agentpool", | |
| "osDiskSizeGB": "[variables('osDiskSizeGB')]", | |
| "count": "[variables('agentCount')]", | |
| "vmSize": "[variables('agentVMSize')]", | |
| "osType": "[variables('osType')]", | |
| "storageProfile": "ManagedDisks" | |
| } | |
| ], | |
| "linuxProfile": { | |
| "adminUsername": "[variables('adminUsername')]", | |
| "ssh": { | |
| "publicKeys": [ | |
| { | |
| "keyData": "[variables('sshRSAPublicKey')]" | |
| } | |
| ] | |
| } | |
| }, | |
| "servicePrincipalProfile": { | |
| "ClientId": "[parameters('servicePrincipalClientId')]", | |
| "Secret": "[parameters('servicePrincipalClientSecret')]" | |
| } | |
| } | |
| }, | |
| { | |
| "type": "Microsoft.TerraformOSS/providerregistrations", | |
| "name": "[parameters('resourceName')]", | |
| "apiVersion": "2018-05-01-preview", | |
| "location": "[parameters('TFRPlocation')]", | |
| "properties": { | |
| "providertype": "kubernetes", | |
| "settings": { | |
| "inline_config": "[Base64ToString(ListCredential(resourceId('Microsoft.ContainerService/managedClusters/accessProfiles', parameters('resourceName'),'clusterAdmin'), '2017-08-31').properties.kubeConfig)]" | |
| } | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.ContainerService/managedClusters', parameters('resourceName'))]" | |
| ] | |
| }, | |
| { | |
| "type": "Microsoft.TerraformOSS/resources", | |
| "name": "mysql-pass", | |
| "apiVersion": "2018-05-01-preview", | |
| "location": "[parameters('TFRPlocation')]", | |
| "properties": { | |
| "providerId": "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]", | |
| "resourcetype": "kubernetes_secret", | |
| "settings": { | |
| "metadata": [ | |
| { | |
| "name": "mysql-pass" | |
| } | |
| ], | |
| "data": [ | |
| { | |
| "password": "MySQL123" | |
| } | |
| ], | |
| "type": "Opaque" | |
| } | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]" | |
| ] | |
| }, | |
| { | |
| "type": "Microsoft.TerraformOSS/resources", | |
| "name": "mysql-pv-claim", | |
| "apiVersion": "2018-05-01-preview", | |
| "location": "[parameters('TFRPlocation')]", | |
| "properties": { | |
| "providerId": "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]", | |
| "resourcetype": "kubernetes_persistent_volume_claim", | |
| "settings": { | |
| "metadata": [ | |
| { | |
| "name": "mysql-pv-claim", | |
| "labels": { | |
| "app": "wordpress" | |
| } | |
| } | |
| ], | |
| "spec": [ | |
| { | |
| "access_modes": [ | |
| "ReadWriteOnce" | |
| ], | |
| "resources": { | |
| "requests": { | |
| "storage": "20Gi" | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]" | |
| ] | |
| }, | |
| { | |
| "type": "Microsoft.TerraformOSS/resources", | |
| "name": "mysql-rc", | |
| "apiVersion": "2018-05-01-preview", | |
| "location": "[parameters('TFRPlocation')]", | |
| "properties": { | |
| "providerId": "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]", | |
| "resourcetype": "kubernetes_replication_controller", | |
| "settings": { | |
| "metadata": [ | |
| { | |
| "name": "mysql", | |
| "labels": { | |
| "app": "wordpress" | |
| } | |
| } | |
| ], | |
| "spec": [ | |
| { | |
| "selector": { | |
| "app": "wordpress", | |
| "tier": "mysql" | |
| }, | |
| "template": [ | |
| { | |
| "container": [ | |
| { | |
| "image": "mysql:5.6", | |
| "name": "mysql", | |
| "env": [ | |
| { | |
| "name": "MYSQL_ROOT_PASSWORD", | |
| "value_from": { | |
| "secret_key_ref": { | |
| "name": "mysql-pass", | |
| "key": "password" | |
| } | |
| } | |
| } | |
| ], | |
| "port": [ | |
| { | |
| "container_port": 3306, | |
| "name": "mysql" | |
| } | |
| ], | |
| "volume_mount": [ | |
| { | |
| "name": "mysql-persistent-storage", | |
| "mount_path": "/var/lib/mysql" | |
| } | |
| ] | |
| } | |
| ], | |
| "volume": [ | |
| { | |
| "name": "mysql-persistent-storage", | |
| "persistent_volume_claim": { | |
| "claim_name": "mysql-pv-claim" | |
| } | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]" | |
| ] | |
| }, | |
| { | |
| "type": "Microsoft.TerraformOSS/resources", | |
| "name": "mysql-svc", | |
| "apiVersion": "2018-05-01-preview", | |
| "location": "[parameters('TFRPlocation')]", | |
| "properties": { | |
| "providerId": "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]", | |
| "resourcetype": "kubernetes_service", | |
| "settings": { | |
| "metadata": [ | |
| { | |
| "name": "mysql", | |
| "labels": { | |
| "app": "wordpress" | |
| } | |
| } | |
| ], | |
| "spec": [ | |
| { | |
| "port": [ | |
| { | |
| "port": 3306, | |
| "target_port": 3306 | |
| } | |
| ], | |
| "selector": { | |
| "app": "wordpress", | |
| "tier": "mysql" | |
| }, | |
| "cluster_ip": "None" | |
| } | |
| ] | |
| } | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]" | |
| ] | |
| }, | |
| { | |
| "type": "Microsoft.TerraformOSS/resources", | |
| "name": "wordpress-pv-claim", | |
| "apiVersion": "2018-05-01-preview", | |
| "location": "[parameters('TFRPlocation')]", | |
| "properties": { | |
| "providerId": "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]", | |
| "resourcetype": "kubernetes_persistent_volume_claim", | |
| "settings": { | |
| "metadata": [ | |
| { | |
| "name": "wp-pv-claim", | |
| "labels": { | |
| "app": "wordpress" | |
| } | |
| } | |
| ], | |
| "spec": [ | |
| { | |
| "access_modes": [ | |
| "ReadWriteOnce" | |
| ], | |
| "resources": { | |
| "requests": { | |
| "storage": "20Gi" | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]" | |
| ] | |
| }, | |
| { | |
| "type": "Microsoft.TerraformOSS/resources", | |
| "name": "wordpress-rc", | |
| "apiVersion": "2018-05-01-preview", | |
| "location": "[parameters('TFRPlocation')]", | |
| "properties": { | |
| "providerId": "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]", | |
| "resourcetype": "kubernetes_replication_controller", | |
| "settings": { | |
| "metadata": [ | |
| { | |
| "name": "wordpress", | |
| "labels": { | |
| "app": "wordpress" | |
| } | |
| } | |
| ], | |
| "spec": [ | |
| { | |
| "selector": { | |
| "app": "wordpress", | |
| "tier": "frontend" | |
| }, | |
| "template": [ | |
| { | |
| "container": [ | |
| { | |
| "image": "wordpress:4.8-apache", | |
| "name": "wordpress", | |
| "env": [ | |
| { | |
| "name": "WORDPRESS_DB_HOST", | |
| "value": "mysql" | |
| }, | |
| { | |
| "name": "WORDPRESS_DB_PASSWORD", | |
| "value_from": { | |
| "secret_key_ref": { | |
| "name": "mysql-pass", | |
| "key": "password" | |
| } | |
| } | |
| } | |
| ], | |
| "port": [ | |
| { | |
| "container_port": 80, | |
| "name": "wordpress" | |
| } | |
| ], | |
| "volume_mount": [ | |
| { | |
| "name": "wordpress-persistent-storage", | |
| "mount_path": "/var/www/html" | |
| } | |
| ] | |
| } | |
| ], | |
| "volume": [ | |
| { | |
| "name": "wordpress-persistent-storage", | |
| "persistent_volume_claim": { | |
| "claim_name": "wp-pv-claim" | |
| } | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]" | |
| ] | |
| }, | |
| { | |
| "type": "Microsoft.TerraformOSS/resources", | |
| "name": "wordpress-svc", | |
| "apiVersion": "2018-05-01-preview", | |
| "location": "[parameters('TFRPlocation')]", | |
| "properties": { | |
| "providerId": "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]", | |
| "resourcetype": "kubernetes_service", | |
| "settings": { | |
| "metadata": [ | |
| { | |
| "name": "wordpress", | |
| "labels": { | |
| "app": "wordpress" | |
| } | |
| } | |
| ], | |
| "spec": [ | |
| { | |
| "port": [ | |
| { | |
| "port": 80, | |
| "target_port": 80 | |
| } | |
| ], | |
| "selector": { | |
| "app": "wordpress", | |
| "tier": "frontend" | |
| }, | |
| "type": "LoadBalancer" | |
| } | |
| ] | |
| } | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.TerraformOSS/providerregistrations', parameters('resourceName'))]" | |
| ] | |
| } | |
| ], | |
| "outputs": { | |
| "controlPlaneFQDN": { | |
| "type": "String", | |
| "value": "[reference(concat('Microsoft.ContainerService/managedClusters/', variables('resourceName'))).fqdn]" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment