Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

[Azure] Upgrade an Azure Data Disk Used in AKS

  • June 16, 2022
  • 6 min read
Cloud and Virtualization Architect. Florent is specializing in public, hybrid, and private cloud technologies. He is a Microsoft MVP in Cloud and Datacenter Management and an MCSE in Private Cloud.
Cloud and Virtualization Architect. Florent is specializing in public, hybrid, and private cloud technologies. He is a Microsoft MVP in Cloud and Datacenter Management and an MCSE in Private Cloud.


One problem that I had recently was a full disk that was being used in a MySQL pod. We will see how to upgrade a disk in such a situation in this article.

As prerequisites, you need:

  •  An AKS cluster
  •  An Azure-managed disk, in my case, 4Gb

– In the RG where AKS resources are located

– In another RG, with Contributor permissions at the RG level, to the AKS SPN

We will start by creating a persistent volume, linked to our disk:

We will now create a persistent volume claim for our application, to use this disk:

These 2 resources are created:

These 2 resources are created

For PV and PVC, it is very important to use a storageClassName that allows you to dynamically extend the volume size: https://docs.microsoft.com/en-us/azure/aks/concepts-storage#persistent-volumes
Otherwise, you will need to delete the PVC/PV and recreate them.

You can use pre-created classes or create your own. The important parameter here is allowVolumeExpansion which must be set to true.

We will now deploy a pod, with the PVC attached:

We will now deploy a pod, with the PVC attached

We can see that the volume has been attached, in Mounts part:

We can see that the volume has been attached, in Mounts part

The first thing, we will connect to the pod to see if the folder has been mounted correctly:

The folder has been mounted correctly

And next, we will create a file inside for the demo:

Create a file inside for the demo

We can see with the df command the size of the volume and the space used. As you can see, there is no more space left:

The size of the volume and the space used

We will now increase the size of our disk. To do this, you need to delete the pod, detach the volume and then increase it:

Increase the size of our disk

You can resize it through the portal or through CLI/PowerShell:

Resize it through the portal or through CLI/PowerShell

Update your PV/PVC with new values:

You can now recreate the pod and see that the volume has now more disk space available:

The volume has now more disk space available

By using an Azure-managed disk, you will have downtime when you extend the disk. If your application must enjoy High Availability (HA), you should use Azure File Share, like this, so that the auto-extend is easier.

Hey! Found Florent’s article helpful? Looking to deploy a new, easy-to-manage, and cost-effective hyperconverged infrastructure?
Alex Bykovskyi
Alex Bykovskyi StarWind Virtual HCI Appliance Product Manager
Well, we can help you with this one! Building a new hyperconverged environment is a breeze with StarWind Virtual HCI Appliance (VHCA). It’s a complete hyperconverged infrastructure solution that combines hypervisor (vSphere, Hyper-V, Proxmox, or our custom version of KVM), software-defined storage (StarWind VSAN), and streamlined management tools. Interested in diving deeper into VHCA’s capabilities and features? Book your StarWind Virtual HCI Appliance demo today!