You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
6.3 KiB

  1. {
  2. "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  3. "contentVersion": "1.0.0.0",
  4. "parameters": {
  5. },
  6. "variables": {
  7. "lbDomainName": "{{nameSuffix}}-api",
  8. "lbPublicIPAddressName": "kubernetes-api-pubip",
  9. "lbPublicIPAddressType": "Static",
  10. "lbPublicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',variables('lbPublicIPAddressName'))]",
  11. "lbName": "kubernetes-api",
  12. "lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]",
  13. "vnetID": "[resourceId('Microsoft.Network/virtualNetworks', '{{virtualNetworkName}}')]",
  14. "kubeMastersSubnetRef": "[concat(variables('vnetID'),'/subnets/', '{{subnetMastersName}}')]"
  15. },
  16. "resources": [
  17. {
  18. "apiVersion": "{{apiVersion}}",
  19. "type": "Microsoft.Network/publicIPAddresses",
  20. "name": "[variables('lbPublicIPAddressName')]",
  21. "location": "[resourceGroup().location]",
  22. "properties": {
  23. "publicIPAllocationMethod": "[variables('lbPublicIPAddressType')]",
  24. "dnsSettings": {
  25. "domainNameLabel": "[variables('lbDomainName')]"
  26. }
  27. }
  28. },
  29. {
  30. "apiVersion": "{{apiVersion}}",
  31. "name": "[variables('lbName')]",
  32. "type": "Microsoft.Network/loadBalancers",
  33. "location": "[resourceGroup().location]",
  34. "dependsOn": [
  35. "[concat('Microsoft.Network/publicIPAddresses/', variables('lbPublicIPAddressName'))]"
  36. ],
  37. "properties": {
  38. "frontendIPConfigurations": [
  39. {
  40. "name": "kube-api-frontend",
  41. "properties": {
  42. "publicIPAddress": {
  43. "id": "[variables('lbPublicIPAddressID')]"
  44. }
  45. }
  46. }
  47. ],
  48. "backendAddressPools": [
  49. {
  50. "name": "kube-api-backend"
  51. }
  52. ],
  53. "loadBalancingRules": [
  54. {
  55. "name": "kube-api",
  56. "properties": {
  57. "frontendIPConfiguration": {
  58. "id": "[concat(variables('lbID'), '/frontendIPConfigurations/kube-api-frontend')]"
  59. },
  60. "backendAddressPool": {
  61. "id": "[concat(variables('lbID'), '/backendAddressPools/kube-api-backend')]"
  62. },
  63. "protocol": "tcp",
  64. "frontendPort": 443,
  65. "backendPort": 443,
  66. "enableFloatingIP": false,
  67. "idleTimeoutInMinutes": 5,
  68. "probe": {
  69. "id": "[concat(variables('lbID'), '/probes/kube-api')]"
  70. }
  71. }
  72. }
  73. ],
  74. "probes": [
  75. {
  76. "name": "kube-api",
  77. "properties": {
  78. "protocol": "tcp",
  79. "port": 443,
  80. "intervalInSeconds": 5,
  81. "numberOfProbes": 2
  82. }
  83. }
  84. ]
  85. }
  86. },
  87. {% for i in range(number_of_k8s_masters) %}
  88. {% if not use_bastion %}
  89. {
  90. "apiVersion": "{{apiVersion}}",
  91. "type": "Microsoft.Network/publicIPAddresses",
  92. "name": "master-{{i}}-pubip",
  93. "location": "[resourceGroup().location]",
  94. "properties": {
  95. "publicIPAllocationMethod": "Static"
  96. }
  97. },
  98. {% endif %}
  99. {
  100. "apiVersion": "{{apiVersion}}",
  101. "type": "Microsoft.Network/networkInterfaces",
  102. "name": "master-{{i}}-nic",
  103. "location": "[resourceGroup().location]",
  104. "dependsOn": [
  105. {% if not use_bastion %}
  106. "[concat('Microsoft.Network/publicIPAddresses/', 'master-{{i}}-pubip')]",
  107. {% endif %}
  108. "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]"
  109. ],
  110. "properties": {
  111. "ipConfigurations": [
  112. {
  113. "name": "MastersIpConfig",
  114. "properties": {
  115. "privateIPAllocationMethod": "Dynamic",
  116. {% if not use_bastion %}
  117. "publicIPAddress": {
  118. "id": "[resourceId('Microsoft.Network/publicIPAddresses', 'master-{{i}}-pubip')]"
  119. },
  120. {% endif %}
  121. "subnet": {
  122. "id": "[variables('kubeMastersSubnetRef')]"
  123. },
  124. "loadBalancerBackendAddressPools": [
  125. {
  126. "id": "[concat(variables('lbID'), '/backendAddressPools/kube-api-backend')]"
  127. }
  128. ]
  129. }
  130. }
  131. ],
  132. "networkSecurityGroup": {
  133. "id": "[resourceId('Microsoft.Network/networkSecurityGroups', '{{securityGroupName}}')]"
  134. },
  135. "enableIPForwarding": true
  136. }
  137. },
  138. {
  139. "type": "Microsoft.Compute/virtualMachines",
  140. "name": "master-{{i}}",
  141. "location": "[resourceGroup().location]",
  142. "dependsOn": [
  143. "[concat('Microsoft.Network/networkInterfaces/', 'master-{{i}}-nic')]"
  144. ],
  145. "tags": {
  146. "roles": "kube-master,etcd"
  147. },
  148. "apiVersion": "{{apiVersion}}",
  149. "properties": {
  150. "availabilitySet": {
  151. "id": "[resourceId('Microsoft.Compute/availabilitySets', '{{availabilitySetMasters}}')]"
  152. },
  153. "hardwareProfile": {
  154. "vmSize": "{{masters_vm_size}}"
  155. },
  156. "osProfile": {
  157. "computerName": "master-{{i}}",
  158. "adminUsername": "{{admin_username}}",
  159. "adminPassword": "{{admin_password}}",
  160. "linuxConfiguration": {
  161. "disablePasswordAuthentication": "{{disablePasswordAuthentication}}",
  162. "ssh": {
  163. "publicKeys": [
  164. {
  165. "path": "{{sshKeyPath}}",
  166. "keyData": "{{ssh_public_key}}"
  167. }
  168. ]
  169. }
  170. }
  171. },
  172. "storageProfile": {
  173. "imageReference": {{imageReferenceJson}},
  174. "osDisk": {
  175. "name": "ma{{nameSuffix}}{{i}}",
  176. "vhd": {
  177. "uri": "[concat('http://','{{storageAccountName}}','.blob.core.windows.net/vhds/master-{{i}}.vhd')]"
  178. },
  179. "caching": "ReadWrite",
  180. "createOption": "FromImage",
  181. "diskSizeGB": "{{masters_os_disk_size}}"
  182. }
  183. },
  184. "networkProfile": {
  185. "networkInterfaces": [
  186. {
  187. "id": "[resourceId('Microsoft.Network/networkInterfaces', 'master-{{i}}-nic')]"
  188. }
  189. ]
  190. }
  191. }
  192. } {% if not loop.last %},{% endif %}
  193. {% endfor %}
  194. ]
  195. }