-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.bicep
89 lines (81 loc) · 2.13 KB
/
main.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// params
@description('The DNS prefix to use with hosted Kubernetes API server FQDN.')
param dnsPrefix string = 'cl01'
@description('The name of the Managed Cluster resource.')
param clusterName string = 'aks101'
@description('Specifies the Azure location where the key vault should be created.')
param location string = resourceGroup().location
@minValue(1)
@maxValue(50)
@description('The number of nodes for the cluster. 1 Node is enough for Dev/Test and minimum 3 nodes, is recommended for Production')
param agentCount int = 1
@description('The size of the Virtual Machine.')
param agentVMSize string = 'Standard_D2_v3'
// vars
var subnetRef = '${vn.id}/subnets/${subnetName}'
var addressPrefix = '20.0.0.0/16'
var subnetName = 'Subnet01'
var subnetPrefix = '20.0.0.0/24'
var virtualNetworkName = 'MyVNET01'
var nodeResourceGroup = 'rg-${dnsPrefix}-${clusterName}'
var tags = {
environment: 'production'
projectCode: 'xyz'
}
var agentPoolName = 'agentpool01'
// Azure virtual network
resource vn 'Microsoft.Network/virtualNetworks@2020-06-01' = {
name: virtualNetworkName
location: location
tags: tags
properties: {
addressSpace: {
addressPrefixes: [
addressPrefix
]
}
subnets: [
{
name: subnetName
properties: {
addressPrefix: subnetPrefix
}
}
]
}
}
// Azure kubernetes service
resource aks 'Microsoft.ContainerService/managedClusters@2020-09-01' = {
name: clusterName
location: location
tags: tags
identity: {
type: 'SystemAssigned'
}
properties: {
enableRBAC: true
dnsPrefix: dnsPrefix
agentPoolProfiles: [
{
name: agentPoolName
count: agentCount
mode: 'System'
vmSize: agentVMSize
type: 'VirtualMachineScaleSets'
osType: 'Linux'
enableAutoScaling: false
vnetSubnetID: subnetRef
}
]
servicePrincipalProfile: {
clientId: 'msi'
}
nodeResourceGroup: nodeResourceGroup
networkProfile: {
networkPlugin: 'azure'
loadBalancerSku: 'standard'
}
}
}
output id string = aks.id
output apiServerAddress string = aks.properties.fqdn