Muokkaa

Jaa


Resize persistent volumes in Azure Container Storage without downtime

You can expand persistent volumes in Azure Container Storage to scale up quickly and without downtime. Shrinking persistent volumes isn't currently supported.

You can't expand a volume beyond the size limits of your storage pool. However, you can expand the storage pool if you're using Azure Disks or Ephemeral Disk, and then expand a volume.

Prerequisites

  • This article requires the latest version (2.35.0 or later) of the Azure CLI. See How to install the Azure CLI. If you're using Azure Cloud Shell, the latest version is already installed. If you plan to run the commands locally instead of in Azure Cloud Shell, be sure to run them with administrative privileges.
  • You'll need an Azure Kubernetes Service (AKS) cluster with a node pool of at least three virtual machines (VMs) for the cluster nodes, each with a minimum of four virtual CPUs (vCPUs).
  • This article assumes you've already installed Azure Container Storage on your AKS cluster, and that you've created a storage pool and persistent volume claim (PVC) using either Azure Disks or ephemeral disk (local storage). Azure Elastic SAN doesn't support resizing volumes or storage pools.

Expand a volume

Follow these instructions to resize a persistent volume. A built-in storage class supports volume expansion, so be sure to reference a PVC previously created by an Azure Container Storage storage class. For example, if you created the PVC for Azure Disks, it might be called azurediskpvc.

  1. Run the following command to expand the PVC by increasing the spec.resources.requests.storage field. Replace <pvc-name> with the name of your PVC. Replace <size-in-Gi> with the new size, for example 100Gi.

    kubectl patch pvc <pvc-name> --type merge --patch '{"spec": {"resources": {"requests": {"storage": "<size-in-Gi>"}}}}'
    
  2. Check the PVC to make sure the volume is expanded:

    kubectl describe pvc <pvc-name>
    

The output should reflect the new size.

See also