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.

StarWind Backup Appliance (BA) is an industry-first all-NVMe backup appliance that provides unprecedented levels of backup and recovery speed. It comes as a tiny, pre-configured, ready-to-backup solution that eliminates the backup server storage bottleneck and fits even the strictest RTPO. Consisting of the best commodity hardware, your chosen hypervisor, and a StarWind SDS engine backed by 24/7/365 ProActive Support, StarWind BA ushers in a new age of a future-proof, eco-friendly, transparent, and reasonably priced backup infrastructure. Explore Backup Appliance from StarWind StarWind Backup Appliance Datasheet
Back to blog