Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
paas-to-aks/azure/scripts/create-aks.ps1
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
59 lines (46 sloc)
1.68 KB
This file contains 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
param ( | |
[Parameter()] | |
[ValidateNotNullOrEmpty()] | |
[string] $Region = 'westeurope', | |
[Parameter(Mandatory = $true)] | |
[ValidateNotNullOrEmpty()] | |
[string] $ResourceGroupName, | |
[Parameter(Mandatory = $true)] | |
[ValidateNotNullOrEmpty()] | |
[string] $AksName, | |
[Parameter(Mandatory = $true)] | |
[ValidateNotNullOrEmpty()] | |
[string] $AzureWindowsPassword | |
) | |
$aksVersion = "1.19.3" | |
# create AKS instance | |
Write-Host "--- Creating AKS Instance K8s version $aksVersion ---" -ForegroundColor Cyan | |
az aks create --resource-group $ResourceGroupName ` | |
--name $AksName ` | |
--kubernetes-version $aksVersion ` | |
--location $Region ` | |
--windows-admin-password $AzureWindowsPassword ` | |
--windows-admin-username azureuser ` | |
--vm-set-type VirtualMachineScaleSets ` | |
--node-count 2 ` | |
--generate-ssh-keys ` | |
--network-plugin azure ` | |
--enable-addons monitoring ` | |
--nodepool-name 'linux' | |
Write-Host "--- Complete: AKS Created ---" -ForegroundColor Green | |
# add windows server nodepool | |
Write-Host "--- Creating Windows Server Node Pool ---" -ForegroundColor Cyan | |
az aks nodepool add --resource-group $ResourceGroupName ` | |
--cluster-name $AksName ` | |
--os-type Windows ` | |
--name 'win' ` | |
--node-vm-size Standard_D4s_v3 ` | |
--node-count 1 | |
Write-Host "--- Complete: Windows Server Node Pool Created ---" -ForegroundColor Green | |
# authenticate AKS instance | |
Write-Host "--- Get credentials for k8s cluster ---" -ForegroundColor Cyan | |
az aks get-credentials --admin ` | |
--resource-group $ResourceGroupName ` | |
--name $AksName ` | |
--overwrite-existing | |
Write-Host "--- Complete: Credentials for k8s cluster retrieved ---" -ForegroundColor Green |