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.

32 lines
1.5 KiB

  1. Param(
  2. [parameter(Mandatory=$true)][string]$resourceGroupName,
  3. [parameter(Mandatory=$true)][string]$location,
  4. [parameter(Mandatory=$false)][string]$registryName,
  5. [parameter(Mandatory=$true)][string]$orchestratorName,
  6. [parameter(Mandatory=$true)][string]$dnsName,
  7. [parameter(Mandatory=$true)][string]$createAcr=$true,
  8. [parameter(Mandatory=$false)][int]$agentCount=2,
  9. [parameter(Mandatory=$false)][string]$agentVMSize="Standard_D2_v2",
  10. [parameter(Mandatory=$false)][int]$masterCount=1
  11. )
  12. # Create resource group
  13. Write-Host "Creating resource group..." -ForegroundColor Yellow
  14. az group create --name=$resourceGroupName --location=$location
  15. if ($createAcr -eq $true) {
  16. # Create Azure Container Registry
  17. Write-Host "Creating Azure Container Registry..." -ForegroundColor Yellow
  18. az acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic
  19. }
  20. # Create kubernetes orchestrator
  21. Write-Host "Creating kubernetes orchestrator..." -ForegroundColor Yellow
  22. az acs create --orchestrator-type=kubernetes --resource-group $resourceGroupName --name=$orchestratorName --dns-prefix=$dnsName --generate-ssh-keys --agent-count=$agentCount --agent-vm-size=$agentVMSize --master-count=$masterCount
  23. # Retrieve kubernetes cluster configuration and save it under ~/.kube/config
  24. az acs kubernetes get-credentials --resource-group=$resourceGroupName --name=$orchestratorName
  25. if ($createAcr -eq $true) {
  26. # Show ACR credentials
  27. az acr credential show -n $registryName
  28. }