azureazure-aksazure-vm-scale-setazure-vmazure-bicep

How to change OS disk SKU for Virtual Machine Scale Set (VMSS)?


I create Azure Kubernetes Service by Bicep like below.

param clusterName string = 'kubernetes'
param location string = resourceGroup().location

resource aksCluster 'Microsoft.ContainerService/managedClusters@2022-02-01' = {
  name: clusterName
  location: location
  sku: {
    name: 'Basic'
    tier: 'Free'
  }
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    kubernetesVersion: '1.23.5'
    enableRBAC: true
    agentPoolProfiles: [
      {
        name: 'agentpool'
        mode: 'System'
        type:'VirtualMachineScaleSets'
        orchestratorVersion: '1.23.5'
        enableAutoScaling: false
        enableFIPS: false
        maxPods: 110
        count: 1
        vmSize: 'Standard_B2s'
        osType:'Linux'
        osSKU:'Ubuntu'
        osDiskType: 'Managed'
        osDiskSizeGB: 0
        enableUltraSSD: false
        enableNodePublicIP: false
      }
    ]
    dnsPrefix: 'kubernetes-cluster-dns'
    networkProfile: {
      loadBalancerSku: 'basic'
      networkPlugin: 'kubenet'
    }
  }
}

Azure Kubernetes Service (AKS) create Virtual Machine Scale Set like below.

VMSS

I do not want to use Premium SSD LRS OS disk. It is too expensive for me while learning kubernetes. I want to change it to Standard SSD LRS.

What should I do?


2022.05.30 Update

I create an issue at Azure/bicep.


Solution

  • Once an Azure resource is deployed, you cannot change its inherent hardware, i.e., disk storage, compute, and memory. Thus, as you have already deployed an AKS cluster with Linux VMs in ‘Standard_B2S’ format and not mentioned any configuration related to the type of disk storage to be used along with it, it usually goes with the default/top option available according to the Azure portal and underlying service fabric infrastructure.

    Also, even if you check while creating a VM or VMSS in Azure, the first option for selecting the type of OS disk storage is always ‘Premium SSD (locally redundant storage)’ in the portal as shown below. Thus, due to which, you should have mentioned the ‘DiskSku: StandardSSD_LRS’ in your bicep template for you to deploy the AKS cluster VMs with standard HDDs.

    Thus, now if you want to change the disk type after deploying the resources, it is not possible and you would need to redeploy the AKS cluster VMs for the disk type to be changed.

    Disk Sku type

    For more information, kindly refer to the documentation link below: -

    https://learn.microsoft.com/en-us/azure/templates/microsoft.compute/disks?tabs=bicep#disksku