little-river-49422
02/14/2019, 9:11 PMimport pulumi
from pulumi import ResourceOptions
from pulumi_azure.core import ResourceGroup
from pulumi_azure.role import Assignment
from <http://pulumi_azure.ad|pulumi_azure.ad> import Application, ServicePrincipal, ServicePrincipalPassword
from pulumi_azure.containerservice import KubernetesCluster, Registry
from pulumi_azure.network import VirtualNetwork, Subnet
from pulumi_kubernetes import Provider
from pulumi_kubernetes.apiextensions.v1beta1 import CustomResourceDefinition
from pulumi_kubernetes.rbac.v1 import ClusterRole
app = Application(
'aks-app',
name=gen_name('aks-app')
)
sp = ServicePrincipal(
'aks-sp',
application_id=app.application_id
)
sppwd = ServicePrincipalPassword(
'aks-sp-pwd',
service_principal_id=sp.id,
end_date='2020-01-01T01:02:03Z',
value="ASKNH(U#D2fji0nfh2f"
)
rg = ResourceGroup(
'rg',
name=gen_name('rg'),
location='westeurope'
)
vnet = VirtualNetwork(
'vnet',
name=gen_name('vnet'),
location=rg.location,
resource_group_name=rg.name,
address_spaces=['10.0.0.0/8']
)
subnet = Subnet(
'subnet',
name=gen_name('subnet'),
resource_group_name=rg.name,
address_prefix='10.0.0.0/24',
virtual_network_name=vnet.name
)
aks = KubernetesCluster(
'aks',
name=gen_name('aks'),
location=rg.location,
resource_group_name=rg.name,
kubernetes_version="1.12.4",
dns_prefix="dns",
agent_pool_profile=(
{
"name": "type1",
"count": 2,
"vmSize": "Standard_B2ms",
"osType": "Linux",
"maxPods": 110,
"vnet_subnet_id": subnet.id
}
),
linux_profile=(
{
"adminUsername": "azureuser",
"ssh_key": [
{
"keyData": "sshkey"
}
]
}
),
service_principal={
"clientId": app.application_id,
"clientSecret": sppwd.value
},
role_based_access_control={
"enabled": "true"
},
network_profile=(
{
"networkPlugin": "azure",
"serviceCidr": "10.10.0.0/16",
"dns_service_ip": "10.10.0.10",
"dockerBridgeCidr": "172.17.0.1/16"
}
)
)