Convert AKS PV to Premium Disk
Convert AKS PV to Premium Disk
AKS Clusters have a few pre-defined storage classes that can be used when creating volumes. These are typically:
If you inspect each of these, you will find the following:
Name | Disk Type | SKU |
---|---|---|
azurefile | Azure File Storage | Standard_LRS |
azurefile-premium | Azure File Storage | Premium_LRS |
default | Azure Managed Disk (Standard SSD) | StandardSSD_LRS |
managed-premium | Azure Managed Disk (Premium SSD) | Premium_LRS |
Note: Premium storage is only available on VMs with an s in the name. E2a_v4 does not support premium, E2as_v4 does
If you need to upgrade your storage class from StandardSSD to Premium, this is how
First, ensure your PV is set to Retain, otherwise you will lose data!!!!!
If your storageclass is set to Delete, you need to patch it
Detach PVC
Make sure you have a way to redeploy. Try exporting the yaml before proceeding
In order to upgrade your storage class, you need to release the PVC by deleting whatever is attached. If you're using a deployment, stateful set or daemomset, delete it. Make sure you have a way to re-deploy
View/Edit the ClaimRef
PVs use a ClaimRef to allow a PVC to re-bind. You'll want to delete the resourceVersion and uid in the claimRef section to allow a re-bind
And delete resourceVersion and uid lines. Do not delete anything else!
Now, find your disk in the Azure Portal by navigating to the cluster resource group. If you are using VMSS Node Pools, go to the VMSS resource group. Search the list for your PV name and click on the disk
The top right will show the current storage class
Click on Configuration and change the Storage Type, then click save. If this option is grayed out, the disk is still bound, make sure you deleted the deployment.
Re-Deploy
Re-deploy your yaml and watch the PVC reconnect to the newly upgraded PV
Seriously, make sure you can re-deploy your Kubernetes objects and that the PV is set to retain. I take no responsibility for lost data