Unable to add spot node pool to Azure Kubernetes Cluster

9/22/2020

Unable to add spot node pool to Azure Kubernetes Cluster

AWS-CLI

azure-cli                         2.12.0

core                              2.12.0
telemetry                          1.0.6

Extensions:
aks-preview                       0.4.63

Following the instructions on Microsoft site: https://docs.microsoft.com/en-us/azure/aks/spot-node-pool

Ran the following

# Create a resource group in East US
az group create --name myResourceGroup --location westus2

# Create a basic single-node AKS cluster
az aks create \
    --resource-group myResourceGroup \
    --name myAKSCluster \
    --vm-set-type VirtualMachineScaleSets \
    --node-count 1 \
    --generate-ssh-keys \
    --load-balancer-sku standard

az aks get-credentials --resource-group myResourceGroup --name myAKSCluster

az aks nodepool add \
    --resource-group myResourceGroup \
    --cluster-name myAKSCluster \
    --name spotnodepool \
    --priority Spot \
    --spot-max-price -1 \
    --eviction-policy Delete \
    --node-vm-size Standard_D2as_v4 \
    --node-count 1

Got the following error: Error code:

ValidationError: Operation failed with status: 'Bad Request'. Details: Provisioning of resource(s) for Agent Pool spotnodepool failed. Error: {
  "code": "InvalidTemplateDeployment",
  "message": "The template deployment failed with error: 'The resource with id: '/subscriptions/REDACTED/resourceGroups/MC_myResourceGroup_myAKSCluster_westus2/providers/Microsoft.Compute/virtualMachineScaleSets/aks-REDACTED-vmss' failed validation with message: 'The requested size for resource '/subscriptions/REDACTED/resourceGroups/MC_myResourceGroup_myAKSCluster_westus2/providers/Microsoft.Compute/virtualMachineScaleSets/aks-REDACTED-vmss' is currently not available in location 'westus2' zones '' for subscription 'REDACTED'. Please try another size or deploy to a different location or zones. See https://aka.ms/azureskunotavailable for details.'.'."
 }

I have tried other AZ region, useast, uswest2, etc but with no luck

If I run the following it will work:

az aks nodepool add \
    --resource-group myResourceGroup \
    --cluster-name myAKSCluster \
    --name mynodepool \
    --node-count 1

Is spot node pool not supported? It is in the official docs: https://docs.microsoft.com/en-us/cli/azure/ext/aks-preview/aks/nodepool?view=azure-cli-latest

-- gpaw
azure
azure-aks
azure-devops
kubernetes

1 Answer

9/26/2020

I just realised that this is not a AKS or Spot issue. This is a subscription issue. In the docs (https://docs.microsoft.com/en-us/azure/virtual-machines/spot-vms#limitations) it says that only Pay-As-You-Go subscription are allowed to use spot instances. I just recently upgraded to Pay-As-You-Go model but my offerID is still stuck as "Free Trial" - I just need to be patient for it to change over

-- gpaw
Source: StackOverflow