-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateMarinerLinuxClusterAKS.ps1
51 lines (43 loc) · 1.47 KB
/
createMarinerLinuxClusterAKS.ps1
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
function create-mariner-linux-cluster {
param (
[Parameter(Mandatory = $true)]
[string]$ResourceGroupName,
[Parameter(Mandatory = $true)]
[string]$ClusterName,
[Parameter(Mandatory = $true)]
[string]$WorkerNodeCount,
[Parameter(Mandatory = $true)]
[string]$KubernetesVersion,
[Parameter(Mandatory = $true)]
[string]$AcrRegistryName,
[Parameter(Mandatory = $true)]
[string]$VmSize,
[Parameter(Mandatory = $true)]
[string]$OsSku,
[Parameter(Mandatory = $true)]
[string]$NodeOsDiskType
)
$aks = az aks show `
--name $ClusterName `
--resource-group $resourceGroupName `
--query name | ConvertFrom-Json
$aksCLusterExists = $aks.Length -gt 0
if ($aksCLusterExists -eq $false) {
# Create AKS cluster
Write-Host "Creating AKS cluster $ClusterName with resource group $ResourceGroupName -ForegroundColor Yellow"
az aks create `
--resource-group $ResourceGroupName `
--name=$ClusterName `
--node-count $WorkerNodeCount `
--enable-managed-identity `
--output jsonc `
--kubernetes-version $KubernetesVersion `
--attach-acr $AcrRegistryName `
--node-vm-size $VmSize `
--os-sku $OsSku `
--node-osdisk-type $NodeOsDiskType
if (!$?) {
Write-Error "Error creating ASK cluster" -ErrorAction Stop
}
}
}