Fxied script supporting dnsNamePrefix param and is aligned with docs
This commit is contained in:
parent
1d2fc6c42b
commit
4db6c58fa6
@ -1,15 +1,16 @@
|
|||||||
Param(
|
Param(
|
||||||
[parameter(Mandatory=$true)][string]$resourceGroupName,
|
[parameter(Mandatory=$true)][string]$resourceGroupName,
|
||||||
[parameter(Mandatory=$true)][string]$location,
|
[parameter(Mandatory=$true)][string]$location,
|
||||||
[parameter(Mandatory=$false)][string]$registryName,
|
|
||||||
[parameter(Mandatory=$true)][string]$serviceName,
|
[parameter(Mandatory=$true)][string]$serviceName,
|
||||||
|
[parameter(Mandatory=$true)][string]$dnsNamePrefix,
|
||||||
|
[parameter(Mandatory=$false)][string]$registryName,
|
||||||
[parameter(Mandatory=$true)][string]$createAcr=$true,
|
[parameter(Mandatory=$true)][string]$createAcr=$true,
|
||||||
[parameter(Mandatory=$false)][int]$nodeCount=3,
|
[parameter(Mandatory=$false)][int]$nodeCount=3,
|
||||||
[parameter(Mandatory=$false)][string]$nodeVMSize="Standard_D2_v2"
|
[parameter(Mandatory=$false)][string]$nodeVMSize="Standard_D2_v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create resource group
|
# Create resource group
|
||||||
Write-Host "Creating resource group..." -ForegroundColor Yellow
|
Write-Host "Creating Azure Resource Group..." -ForegroundColor Yellow
|
||||||
az group create --name=$resourceGroupName --location=$location
|
az group create --name=$resourceGroupName --location=$location
|
||||||
|
|
||||||
if ($createAcr -eq $true) {
|
if ($createAcr -eq $true) {
|
||||||
@ -18,14 +19,16 @@ if ($createAcr -eq $true) {
|
|||||||
az acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic
|
az acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create kubernetes orchestrator
|
# Create kubernetes cluster in AKS
|
||||||
Write-Host "Creating kubernetes orchestrator..." -ForegroundColor Yellow
|
Write-Host "Creating Kubernetes cluster in AKS..." -ForegroundColor Yellow
|
||||||
az aks create --resource-group=$resourceGroupName --name=$serviceName --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize
|
az aks create --resource-group=$resourceGroupName --name=$serviceName --dns-name-prefix=$dnsNamePrefix --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize
|
||||||
|
|
||||||
# Retrieve kubernetes cluster configuration and save it under ~/.kube/config
|
# Retrieve kubernetes cluster configuration and save it under ~/.kube/config
|
||||||
|
Write-Host "Getting Kubernetes config..." -ForegroundColor Yellow
|
||||||
az aks get-credentials --resource-group=$resourceGroupName --name=$serviceName
|
az aks get-credentials --resource-group=$resourceGroupName --name=$serviceName
|
||||||
|
|
||||||
if ($createAcr -eq $true) {
|
if ($createAcr -eq $true) {
|
||||||
# Show ACR credentials
|
# Show ACR credentials
|
||||||
|
Write-Host "ACR credentials" -ForegroundColor Yellow
|
||||||
az acr credential show -n $registryName
|
az acr credential show -n $registryName
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user